1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 08:48:11 +00:00

LibCore: Remove ObjectPtr in favor of RefPtr

Now that CObject is fully ref-counted, just use RefPtr everywhere! :^)
This commit is contained in:
Andreas Kling 2019-09-22 00:31:54 +02:00
parent bc319d9e88
commit d6abfbdc5a
71 changed files with 146 additions and 156 deletions

View file

@ -25,26 +25,26 @@ private:
Calculator m_calculator; Calculator m_calculator;
Keypad m_keypad; Keypad m_keypad;
ObjectPtr<GTextBox> m_entry; RefPtr<GTextBox> m_entry;
ObjectPtr<GLabel> m_label; RefPtr<GLabel> m_label;
ObjectPtr<GButton> m_digit_button[10]; RefPtr<GButton> m_digit_button[10];
ObjectPtr<GButton> m_mem_add_button; RefPtr<GButton> m_mem_add_button;
ObjectPtr<GButton> m_mem_save_button; RefPtr<GButton> m_mem_save_button;
ObjectPtr<GButton> m_mem_recall_button; RefPtr<GButton> m_mem_recall_button;
ObjectPtr<GButton> m_mem_clear_button; RefPtr<GButton> m_mem_clear_button;
ObjectPtr<GButton> m_clear_button; RefPtr<GButton> m_clear_button;
ObjectPtr<GButton> m_clear_error_button; RefPtr<GButton> m_clear_error_button;
ObjectPtr<GButton> m_backspace_button; RefPtr<GButton> m_backspace_button;
ObjectPtr<GButton> m_decimal_point_button; RefPtr<GButton> m_decimal_point_button;
ObjectPtr<GButton> m_sign_button; RefPtr<GButton> m_sign_button;
ObjectPtr<GButton> m_add_button; RefPtr<GButton> m_add_button;
ObjectPtr<GButton> m_subtract_button; RefPtr<GButton> m_subtract_button;
ObjectPtr<GButton> m_multiply_button; RefPtr<GButton> m_multiply_button;
ObjectPtr<GButton> m_divide_button; RefPtr<GButton> m_divide_button;
ObjectPtr<GButton> m_sqrt_button; RefPtr<GButton> m_sqrt_button;
ObjectPtr<GButton> m_inverse_button; RefPtr<GButton> m_inverse_button;
ObjectPtr<GButton> m_percent_button; RefPtr<GButton> m_percent_button;
ObjectPtr<GButton> m_equals_button; RefPtr<GButton> m_equals_button;
}; };

View file

@ -25,5 +25,5 @@ private:
BoardListModel(); BoardListModel();
JsonArray m_boards; JsonArray m_boards;
ObjectPtr<CHttpJob> m_pending_job; RefPtr<CHttpJob> m_pending_job;
}; };

View file

@ -37,5 +37,5 @@ private:
String m_board { "g" }; String m_board { "g" };
JsonArray m_catalog; JsonArray m_catalog;
ObjectPtr<CHttpJob> m_pending_job; RefPtr<CHttpJob> m_pending_job;
}; };

View file

@ -40,10 +40,10 @@ private:
private: private:
String m_wallpaper_path; String m_wallpaper_path;
RefPtr<CConfigFile> m_wm_config; RefPtr<CConfigFile> m_wm_config;
ObjectPtr<GWidget> m_root_widget; RefPtr<GWidget> m_root_widget;
Vector<Size> m_resolutions; Vector<Size> m_resolutions;
Vector<String> m_wallpapers; Vector<String> m_wallpapers;
ObjectPtr<GLabel> m_wallpaper_preview; RefPtr<GLabel> m_wallpaper_preview;
Size m_selected_resolution; Size m_selected_resolution;
String m_selected_wallpaper; String m_selected_wallpaper;

View file

@ -72,6 +72,6 @@ private:
Vector<String> m_path_history; Vector<String> m_path_history;
void add_path_to_history(const StringView& path); void add_path_to_history(const StringView& path);
ObjectPtr<GTableView> m_table_view; RefPtr<GTableView> m_table_view;
ObjectPtr<GItemView> m_item_view; RefPtr<GItemView> m_item_view;
}; };

View file

@ -27,8 +27,8 @@ private:
IRCWindow& create_window(void* owner, IRCWindow::Type, const String& name); IRCWindow& create_window(void* owner, IRCWindow::Type, const String& name);
IRCClient m_client; IRCClient m_client;
ObjectPtr<GStackWidget> m_container; RefPtr<GStackWidget> m_container;
ObjectPtr<GTableView> m_window_list; RefPtr<GTableView> m_window_list;
RefPtr<GAction> m_join_action; RefPtr<GAction> m_join_action;
RefPtr<GAction> m_part_action; RefPtr<GAction> m_part_action;
RefPtr<GAction> m_whois_action; RefPtr<GAction> m_whois_action;

View file

@ -8,7 +8,6 @@
#include <AK/String.h> #include <AK/String.h>
#include <LibCore/CConfigFile.h> #include <LibCore/CConfigFile.h>
#include <LibCore/CTCPSocket.h> #include <LibCore/CTCPSocket.h>
#include <LibCore/ObjectPtr.h>
class IRCChannel; class IRCChannel;
class IRCQuery; class IRCQuery;
@ -137,10 +136,10 @@ private:
String m_hostname; String m_hostname;
int m_port { 6667 }; int m_port { 6667 };
ObjectPtr<CTCPSocket> m_socket; RefPtr<CTCPSocket> m_socket;
String m_nickname; String m_nickname;
ObjectPtr<CNotifier> m_notifier; RefPtr<CNotifier> m_notifier;
HashMap<String, RefPtr<IRCChannel>, CaseInsensitiveStringTraits> m_channels; HashMap<String, RefPtr<IRCChannel>, CaseInsensitiveStringTraits> m_channels;
HashMap<String, RefPtr<IRCQuery>, CaseInsensitiveStringTraits> m_queries; HashMap<String, RefPtr<IRCQuery>, CaseInsensitiveStringTraits> m_queries;

View file

@ -46,8 +46,8 @@ private:
void* m_owner { nullptr }; void* m_owner { nullptr };
Type m_type; Type m_type;
String m_name; String m_name;
ObjectPtr<GTableView> m_table_view; RefPtr<GTableView> m_table_view;
ObjectPtr<GTextEditor> m_text_editor; RefPtr<GTextEditor> m_text_editor;
RefPtr<IRCLogBuffer> m_log_buffer; RefPtr<IRCLogBuffer> m_log_buffer;
int m_unread_count { 0 }; int m_unread_count { 0 };
}; };

View file

@ -12,7 +12,7 @@
#include <sys/wait.h> #include <sys/wait.h>
#include <unistd.h> #include <unistd.h>
static ObjectPtr<GWindow> make_launcher_window(); static RefPtr<GWindow> make_launcher_window();
void handle_sigchld(int) void handle_sigchld(int)
{ {
@ -63,7 +63,7 @@ private:
String m_executable_path; String m_executable_path;
}; };
ObjectPtr<GWindow> make_launcher_window() RefPtr<GWindow> make_launcher_window()
{ {
auto config = CConfigFile::get_for_app("Launcher"); auto config = CConfigFile::get_for_app("Launcher");
auto vertical = config->read_bool_entry("Launcher", "Vertical", true); auto vertical = config->read_bool_entry("Launcher", "Vertical", true);

View file

@ -17,5 +17,5 @@ private:
void build(); void build();
Color m_color; Color m_color;
ObjectPtr<GFrame> m_preview_widget; RefPtr<GFrame> m_preview_widget;
}; };

View file

@ -15,6 +15,6 @@ public:
private: private:
PaintableWidget& m_paintable_widget; PaintableWidget& m_paintable_widget;
ObjectPtr<GFrame> m_primary_color_widget; RefPtr<GFrame> m_primary_color_widget;
ObjectPtr<GFrame> m_secondary_color_widget; RefPtr<GFrame> m_secondary_color_widget;
}; };

View file

@ -19,7 +19,7 @@ public:
private: private:
virtual const char* class_name() const override { return "SprayTool"; } virtual const char* class_name() const override { return "SprayTool"; }
void paint_it(); void paint_it();
ObjectPtr<CTimer> m_timer; RefPtr<CTimer> m_timer;
Point m_last_pos; Point m_last_pos;
Color m_color; Color m_color;
OwnPtr<GMenu> m_context_menu; OwnPtr<GMenu> m_context_menu;

View file

@ -22,7 +22,7 @@ MemoryStatsWidget::MemoryStatsWidget(GraphWidget& graph, GWidget* parent)
layout()->set_margins({ 0, 8, 0, 0 }); layout()->set_margins({ 0, 8, 0, 0 });
layout()->set_spacing(3); layout()->set_spacing(3);
auto build_widgets_for_label = [this](const String& description) -> ObjectPtr<GLabel> { auto build_widgets_for_label = [this](const String& description) -> RefPtr<GLabel> {
auto container = GWidget::construct(this); auto container = GWidget::construct(this);
container->set_layout(make<GBoxLayout>(Orientation::Horizontal)); container->set_layout(make<GBoxLayout>(Orientation::Horizontal));
container->set_size_policy(SizePolicy::Fixed, SizePolicy::Fixed); container->set_size_policy(SizePolicy::Fixed, SizePolicy::Fixed);

View file

@ -18,9 +18,9 @@ private:
virtual void timer_event(CTimerEvent&) override; virtual void timer_event(CTimerEvent&) override;
GraphWidget& m_graph; GraphWidget& m_graph;
ObjectPtr<GLabel> m_user_physical_pages_label; RefPtr<GLabel> m_user_physical_pages_label;
ObjectPtr<GLabel> m_supervisor_physical_pages_label; RefPtr<GLabel> m_supervisor_physical_pages_label;
ObjectPtr<GLabel> m_kmalloc_label; RefPtr<GLabel> m_kmalloc_label;
ObjectPtr<GLabel> m_kmalloc_count_label; RefPtr<GLabel> m_kmalloc_count_label;
ObjectPtr<CFile> m_proc_memstat; RefPtr<CFile> m_proc_memstat;
}; };

View file

@ -14,7 +14,7 @@ private:
explicit NetworkStatisticsWidget(GWidget* parent = nullptr); explicit NetworkStatisticsWidget(GWidget* parent = nullptr);
void update_models(); void update_models();
ObjectPtr<GTableView> m_adapter_table_view; RefPtr<GTableView> m_adapter_table_view;
ObjectPtr<GTableView> m_socket_table_view; RefPtr<GTableView> m_socket_table_view;
ObjectPtr<CTimer> m_update_timer; RefPtr<CTimer> m_update_timer;
}; };

View file

@ -14,6 +14,6 @@ public:
private: private:
explicit ProcessFileDescriptorMapWidget(GWidget* parent); explicit ProcessFileDescriptorMapWidget(GWidget* parent);
ObjectPtr<GTableView> m_table_view; RefPtr<GTableView> m_table_view;
pid_t m_pid { -1 }; pid_t m_pid { -1 };
}; };

View file

@ -13,6 +13,6 @@ public:
private: private:
explicit ProcessMemoryMapWidget(GWidget* parent); explicit ProcessMemoryMapWidget(GWidget* parent);
ObjectPtr<GTableView> m_table_view; RefPtr<GTableView> m_table_view;
pid_t m_pid { -1 }; pid_t m_pid { -1 };
}; };

View file

@ -1,6 +1,5 @@
#pragma once #pragma once
#include <LibCore/ObjectPtr.h>
#include <LibGUI/GTextEditor.h> #include <LibGUI/GTextEditor.h>
#include <LibGUI/GWidget.h> #include <LibGUI/GWidget.h>
@ -17,6 +16,6 @@ public:
private: private:
pid_t m_pid { -1 }; pid_t m_pid { -1 };
ObjectPtr<GTextEditor> m_stacks_editor; RefPtr<GTextEditor> m_stacks_editor;
ObjectPtr<CTimer> m_timer; RefPtr<CTimer> m_timer;
}; };

View file

@ -39,9 +39,9 @@ static String human_readable_size(u32 size)
return String::format("%u GB", size / GB); return String::format("%u GB", size / GB);
} }
static ObjectPtr<GWidget> build_file_systems_tab(); static RefPtr<GWidget> build_file_systems_tab();
static ObjectPtr<GWidget> build_pci_devices_tab(); static RefPtr<GWidget> build_pci_devices_tab();
static ObjectPtr<GWidget> build_devices_tab(); static RefPtr<GWidget> build_devices_tab();
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
@ -234,7 +234,7 @@ public:
} }
}; };
ObjectPtr<GWidget> build_file_systems_tab() RefPtr<GWidget> build_file_systems_tab()
{ {
auto fs_widget = GWidget::construct(); auto fs_widget = GWidget::construct();
fs_widget->set_layout(make<GBoxLayout>(Orientation::Vertical)); fs_widget->set_layout(make<GBoxLayout>(Orientation::Vertical));
@ -299,7 +299,7 @@ ObjectPtr<GWidget> build_file_systems_tab()
return fs_widget; return fs_widget;
} }
ObjectPtr<GWidget> build_pci_devices_tab() RefPtr<GWidget> build_pci_devices_tab()
{ {
auto pci_widget = GWidget::construct(); auto pci_widget = GWidget::construct();
pci_widget->set_layout(make<GBoxLayout>(Orientation::Vertical)); pci_widget->set_layout(make<GBoxLayout>(Orientation::Vertical));
@ -353,7 +353,7 @@ ObjectPtr<GWidget> build_pci_devices_tab()
return pci_widget; return pci_widget;
} }
ObjectPtr<GWidget> build_devices_tab() RefPtr<GWidget> build_devices_tab()
{ {
auto devices_widget = GWidget::construct(); auto devices_widget = GWidget::construct();
devices_widget->set_layout(make<GBoxLayout>(Orientation::Vertical)); devices_widget->set_layout(make<GBoxLayout>(Orientation::Vertical));

View file

@ -88,7 +88,7 @@ private:
bool m_in_active_window { false }; bool m_in_active_window { false };
ObjectPtr<CNotifier> m_notifier; RefPtr<CNotifier> m_notifier;
u8 m_opacity { 255 }; u8 m_opacity { 255 };
bool m_needs_background_fill { true }; bool m_needs_background_fill { true };
@ -96,9 +96,9 @@ private:
int m_glyph_width { 0 }; int m_glyph_width { 0 };
ObjectPtr<CTimer> m_cursor_blink_timer; RefPtr<CTimer> m_cursor_blink_timer;
ObjectPtr<CTimer> m_visual_beep_timer; RefPtr<CTimer> m_visual_beep_timer;
RefPtr<CConfigFile> m_config; RefPtr<CConfigFile> m_config;
ObjectPtr<GScrollBar> m_scrollbar; RefPtr<GScrollBar> m_scrollbar;
}; };

View file

@ -88,7 +88,7 @@ static void run_command(int ptm_fd, String command)
} }
} }
ObjectPtr<GWindow> create_settings_window(TerminalWidget& terminal, RefPtr<CConfigFile> config) RefPtr<GWindow> create_settings_window(TerminalWidget& terminal, RefPtr<CConfigFile> config)
{ {
auto window = GWindow::construct(); auto window = GWindow::construct();
window->set_title("Terminal Settings"); window->set_title("Terminal Settings");
@ -170,7 +170,7 @@ int main(int argc, char** argv)
window->set_icon(load_png("/res/icons/16x16/app-terminal.png")); window->set_icon(load_png("/res/icons/16x16/app-terminal.png"));
terminal->set_should_beep(config->read_bool_entry("Window", "AudibleBeep", false)); terminal->set_should_beep(config->read_bool_entry("Window", "AudibleBeep", false));
ObjectPtr<GWindow> settings_window; RefPtr<GWindow> settings_window;
auto new_opacity = config->read_num_entry("Window", "Opacity", 255); auto new_opacity = config->read_num_entry("Window", "Opacity", 255);
terminal->set_opacity(new_opacity); terminal->set_opacity(new_opacity);

View file

@ -24,7 +24,7 @@ private:
void set_path(const FileSystemPath& file); void set_path(const FileSystemPath& file);
void update_title(); void update_title();
ObjectPtr<GTextEditor> m_editor; RefPtr<GTextEditor> m_editor;
String m_path; String m_path;
String m_name; String m_name;
String m_extension; String m_extension;
@ -37,12 +37,12 @@ private:
RefPtr<GAction> m_find_next_action; RefPtr<GAction> m_find_next_action;
RefPtr<GAction> m_find_previous_action; RefPtr<GAction> m_find_previous_action;
ObjectPtr<GStatusBar> m_statusbar; RefPtr<GStatusBar> m_statusbar;
ObjectPtr<GTextBox> m_find_textbox; RefPtr<GTextBox> m_find_textbox;
GButton* m_find_previous_button { nullptr }; GButton* m_find_previous_button { nullptr };
GButton* m_find_next_button { nullptr }; GButton* m_find_next_button { nullptr };
ObjectPtr<GWidget> m_find_widget; RefPtr<GWidget> m_find_widget;
bool m_document_dirty { false }; bool m_document_dirty { false };
}; };

View file

@ -44,14 +44,14 @@ int main(int argc, char** argv)
}); });
dbg() << "struct UI_" << name << " {"; dbg() << "struct UI_" << name << " {";
dbg() << " ObjectPtr<GWidget> main_widget;"; dbg() << " RefPtr<GWidget> main_widget;";
widgets.as_array().for_each([&](auto& value) { widgets.as_array().for_each([&](auto& value) {
ASSERT(value.is_object()); ASSERT(value.is_object());
const JsonObject& widget_object = value.as_object(); const JsonObject& widget_object = value.as_object();
auto name = widget_object.get("name").to_string(); auto name = widget_object.get("name").to_string();
auto class_name = widget_object.get("class").to_string(); auto class_name = widget_object.get("class").to_string();
dbg() << " ObjectPtr<" << class_name << "> " << name << ";"; dbg() << " RefPtr<" << class_name << "> " << name << ";";
}); });
dbg() << " UI_" << name << "();"; dbg() << " UI_" << name << "();";

View file

@ -32,6 +32,6 @@ private:
pid_t m_pid { -1 }; pid_t m_pid { -1 };
String m_process_name; String m_process_name;
NonnullRefPtr<RemoteObjectGraphModel> m_object_graph_model; NonnullRefPtr<RemoteObjectGraphModel> m_object_graph_model;
ObjectPtr<CLocalSocket> m_socket; RefPtr<CLocalSocket> m_socket;
NonnullOwnPtrVector<RemoteObject> m_roots; NonnullOwnPtrVector<RemoteObject> m_roots;
}; };

View file

@ -31,7 +31,7 @@ public:
BoolModelEditingDelegate() {} BoolModelEditingDelegate() {}
virtual ~BoolModelEditingDelegate() override {} virtual ~BoolModelEditingDelegate() override {}
virtual ObjectPtr<GWidget> create_widget() override virtual RefPtr<GWidget> create_widget() override
{ {
auto combo = GComboBox::construct(nullptr); auto combo = GComboBox::construct(nullptr);
combo->set_only_allow_values_from_model(true); combo->set_only_allow_values_from_model(true);

View file

@ -15,5 +15,5 @@ public:
const GTableView& table_view() const { return *m_table_view; } const GTableView& table_view() const { return *m_table_view; }
private: private:
ObjectPtr<GTableView> m_table_view; RefPtr<GTableView> m_table_view;
}; };

View file

@ -81,7 +81,7 @@ private:
VBWidgetType m_type { VBWidgetType::None }; VBWidgetType m_type { VBWidgetType::None };
VBForm& m_form; VBForm& m_form;
ObjectPtr<GWidget> m_gwidget; RefPtr<GWidget> m_gwidget;
NonnullOwnPtrVector<VBProperty> m_properties; NonnullOwnPtrVector<VBProperty> m_properties;
NonnullRefPtr<VBWidgetPropertyModel> m_property_model; NonnullRefPtr<VBWidgetPropertyModel> m_property_model;
Rect m_transform_origin_rect; Rect m_transform_origin_rect;

View file

@ -68,7 +68,7 @@ VBWidgetType widget_type_from_class_name(const StringView& name)
ASSERT_NOT_REACHED(); ASSERT_NOT_REACHED();
} }
static ObjectPtr<GWidget> build_gwidget(VBWidgetType type, GWidget* parent) static RefPtr<GWidget> build_gwidget(VBWidgetType type, GWidget* parent)
{ {
switch (type) { switch (type) {
case VBWidgetType::GWidget: case VBWidgetType::GWidget:
@ -125,7 +125,7 @@ static ObjectPtr<GWidget> build_gwidget(VBWidgetType type, GWidget* parent)
} }
} }
ObjectPtr<GWidget> VBWidgetRegistry::build_gwidget(VBWidget& widget, VBWidgetType type, GWidget* parent, NonnullOwnPtrVector<VBProperty>& properties) RefPtr<GWidget> VBWidgetRegistry::build_gwidget(VBWidget& widget, VBWidgetType type, GWidget* parent, NonnullOwnPtrVector<VBProperty>& properties)
{ {
auto gwidget = ::build_gwidget(type, parent); auto gwidget = ::build_gwidget(type, parent);
auto add_readonly_property = [&](const String& name, const GVariant& value) { auto add_readonly_property = [&](const String& name, const GVariant& value) {

View file

@ -19,7 +19,7 @@ public:
callback((VBWidgetType)i); callback((VBWidgetType)i);
} }
static ObjectPtr<GWidget> build_gwidget(VBWidget&, VBWidgetType, GWidget* parent, NonnullOwnPtrVector<VBProperty>&); static RefPtr<GWidget> build_gwidget(VBWidget&, VBWidgetType, GWidget* parent, NonnullOwnPtrVector<VBProperty>&);
}; };
String to_class_name(VBWidgetType); String to_class_name(VBWidgetType);

View file

@ -17,7 +17,7 @@
#include <stdio.h> #include <stdio.h>
#include <unistd.h> #include <unistd.h>
static ObjectPtr<GWindow> make_toolbox_window(); static RefPtr<GWindow> make_toolbox_window();
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
@ -74,7 +74,7 @@ int main(int argc, char** argv)
return app.exec(); return app.exec();
} }
ObjectPtr<GWindow> make_toolbox_window() RefPtr<GWindow> make_toolbox_window()
{ {
auto window = GWindow::construct(); auto window = GWindow::construct();
window->set_title("Widgets"); window->set_title("Widgets");

View file

@ -95,7 +95,7 @@ private:
GButton& m_face_button; GButton& m_face_button;
GLabel& m_flag_label; GLabel& m_flag_label;
GLabel& m_time_label; GLabel& m_time_label;
ObjectPtr<CTimer> m_timer; RefPtr<CTimer> m_timer;
int m_time_elapsed { 0 }; int m_time_elapsed { 0 };
int m_flags_left { 0 }; int m_flags_left { 0 };
Face m_face { Face::Default }; Face m_face { Face::Default };

View file

@ -29,7 +29,7 @@ public:
private: private:
bool parse_header(); bool parse_header();
ObjectPtr<CFile> m_file; RefPtr<CFile> m_file;
String m_error_string; String m_error_string;
u32 m_sample_rate { 0 }; u32 m_sample_rate { 0 };

View file

@ -29,12 +29,12 @@ HashMap<int, NonnullOwnPtr<CEventLoop::EventLoopTimer>>* CEventLoop::s_timers;
HashTable<CNotifier*>* CEventLoop::s_notifiers; HashTable<CNotifier*>* CEventLoop::s_notifiers;
int CEventLoop::s_next_timer_id = 1; int CEventLoop::s_next_timer_id = 1;
int CEventLoop::s_wake_pipe_fds[2]; int CEventLoop::s_wake_pipe_fds[2];
ObjectPtr<CLocalServer> CEventLoop::s_rpc_server; RefPtr<CLocalServer> CEventLoop::s_rpc_server;
class RPCClient : public CObject { class RPCClient : public CObject {
C_OBJECT(RPCClient) C_OBJECT(RPCClient)
public: public:
explicit RPCClient(ObjectPtr<CLocalSocket> socket) explicit RPCClient(RefPtr<CLocalSocket> socket)
: m_socket(move(socket)) : m_socket(move(socket))
{ {
add_child(*m_socket); add_child(*m_socket);
@ -123,7 +123,7 @@ public:
} }
private: private:
ObjectPtr<CLocalSocket> m_socket; RefPtr<CLocalSocket> m_socket;
}; };
CEventLoop::CEventLoop() CEventLoop::CEventLoop()

View file

@ -87,5 +87,5 @@ private:
static HashTable<CNotifier*>* s_notifiers; static HashTable<CNotifier*>* s_notifiers;
static ObjectPtr<CLocalServer> s_rpc_server; static RefPtr<CLocalServer> s_rpc_server;
}; };

View file

@ -27,7 +27,7 @@ private:
}; };
CHttpRequest m_request; CHttpRequest m_request;
ObjectPtr<CTCPSocket> m_socket; RefPtr<CTCPSocket> m_socket;
State m_state { State::InStatus }; State m_state { State::InStatus };
int m_code { -1 }; int m_code { -1 };
HashMap<String, String> m_headers; HashMap<String, String> m_headers;

View file

@ -10,7 +10,7 @@ CHttpRequest::~CHttpRequest()
{ {
} }
ObjectPtr<CNetworkJob> CHttpRequest::schedule() RefPtr<CNetworkJob> CHttpRequest::schedule()
{ {
auto job = CHttpJob::construct(*this); auto job = CHttpJob::construct(*this);
job->start(); job->start();

View file

@ -2,7 +2,6 @@
#include <AK/String.h> #include <AK/String.h>
#include <AK/URL.h> #include <AK/URL.h>
#include <LibCore/ObjectPtr.h>
class CNetworkJob; class CNetworkJob;
@ -27,7 +26,7 @@ public:
String method_name() const; String method_name() const;
ByteBuffer to_raw_request() const; ByteBuffer to_raw_request() const;
ObjectPtr<CNetworkJob> schedule(); RefPtr<CNetworkJob> schedule();
private: private:
URL m_url; URL m_url;

View file

@ -39,7 +39,7 @@ bool CLocalServer::listen(const String& address)
return true; return true;
} }
ObjectPtr<CLocalSocket> CLocalServer::accept() RefPtr<CLocalSocket> CLocalServer::accept()
{ {
ASSERT(m_listening); ASSERT(m_listening);
sockaddr_un un; sockaddr_un un;

View file

@ -13,7 +13,7 @@ public:
bool is_listening() const { return m_listening; } bool is_listening() const { return m_listening; }
bool listen(const String& address); bool listen(const String& address);
ObjectPtr<CLocalSocket> accept(); RefPtr<CLocalSocket> accept();
Function<void()> on_ready_to_accept; Function<void()> on_ready_to_accept;
@ -22,5 +22,5 @@ private:
int m_fd { -1 }; int m_fd { -1 };
bool m_listening { false }; bool m_listening { false };
ObjectPtr<CNotifier> m_notifier; RefPtr<CNotifier> m_notifier;
}; };

View file

@ -2,7 +2,6 @@
#include <AK/Function.h> #include <AK/Function.h>
#include <LibCore/CObject.h> #include <LibCore/CObject.h>
#include <LibCore/ObjectPtr.h>
class CNotifier : public CObject { class CNotifier : public CObject {
C_OBJECT(CNotifier) C_OBJECT(CNotifier)

View file

@ -8,7 +8,6 @@
#include <AK/String.h> #include <AK/String.h>
#include <AK/Vector.h> #include <AK/Vector.h>
#include <AK/Weakable.h> #include <AK/Weakable.h>
#include <LibCore/ObjectPtr.h>
namespace AK { namespace AK {
class JsonObject; class JsonObject;

View file

@ -2,7 +2,6 @@
#include <LibCore/CIODevice.h> #include <LibCore/CIODevice.h>
#include <LibCore/CSocketAddress.h> #include <LibCore/CSocketAddress.h>
#include <LibCore/ObjectPtr.h>
class CNotifier; class CNotifier;
@ -54,6 +53,6 @@ private:
bool common_connect(const struct sockaddr*, socklen_t); bool common_connect(const struct sockaddr*, socklen_t);
Type m_type { Type::Invalid }; Type m_type { Type::Invalid };
ObjectPtr<CNotifier> m_notifier; RefPtr<CNotifier> m_notifier;
ObjectPtr<CNotifier> m_read_notifier; RefPtr<CNotifier> m_read_notifier;
}; };

View file

@ -40,7 +40,7 @@ bool CTCPServer::listen(const IPv4Address& address, u16 port)
return true; return true;
} }
ObjectPtr<CTCPSocket> CTCPServer::accept() RefPtr<CTCPSocket> CTCPServer::accept()
{ {
ASSERT(m_listening); ASSERT(m_listening);
sockaddr_in in; sockaddr_in in;

View file

@ -14,7 +14,7 @@ public:
bool is_listening() const { return m_listening; } bool is_listening() const { return m_listening; }
bool listen(const IPv4Address& address, u16 port); bool listen(const IPv4Address& address, u16 port);
ObjectPtr<CTCPSocket> accept(); RefPtr<CTCPSocket> accept();
Function<void()> on_ready_to_accept; Function<void()> on_ready_to_accept;
@ -23,5 +23,5 @@ private:
int m_fd { -1 }; int m_fd { -1 };
bool m_listening { false }; bool m_listening { false };
ObjectPtr<CNotifier> m_notifier; RefPtr<CNotifier> m_notifier;
}; };

View file

@ -2,7 +2,6 @@
#include <AK/Function.h> #include <AK/Function.h>
#include <LibCore/CObject.h> #include <LibCore/CObject.h>
#include <LibCore/ObjectPtr.h>
class CTimer final : public CObject { class CTimer final : public CObject {
C_OBJECT(CTimer) C_OBJECT(CTimer)

View file

@ -229,8 +229,8 @@ namespace Client {
} }
} }
ObjectPtr<CLocalSocket> m_connection; RefPtr<CLocalSocket> m_connection;
ObjectPtr<CNotifier> m_notifier; RefPtr<CNotifier> m_notifier;
Vector<IncomingMessageBundle> m_unprocessed_bundles; Vector<IncomingMessageBundle> m_unprocessed_bundles;
int m_server_pid { -1 }; int m_server_pid { -1 };
int m_my_client_id { -1 }; int m_my_client_id { -1 };
@ -372,8 +372,8 @@ namespace Client {
} }
} }
ObjectPtr<CLocalSocket> m_connection; RefPtr<CLocalSocket> m_connection;
ObjectPtr<CNotifier> m_notifier; RefPtr<CNotifier> m_notifier;
Vector<OwnPtr<IMessage>> m_unprocessed_messages; Vector<OwnPtr<IMessage>> m_unprocessed_messages;
int m_server_pid { -1 }; int m_server_pid { -1 };
int m_my_client_id { -1 }; int m_my_client_id { -1 };

View file

@ -203,7 +203,7 @@ namespace Server {
virtual bool handle_message(const ClientMessage&, const ByteBuffer&& = {}) = 0; virtual bool handle_message(const ClientMessage&, const ByteBuffer&& = {}) = 0;
private: private:
ObjectPtr<CLocalSocket> m_socket; RefPtr<CLocalSocket> m_socket;
int m_client_id { -1 }; int m_client_id { -1 };
int m_client_pid { -1 }; int m_client_pid { -1 };
}; };
@ -311,7 +311,7 @@ namespace Server {
private: private:
Endpoint& m_endpoint; Endpoint& m_endpoint;
ObjectPtr<CLocalSocket> m_socket; RefPtr<CLocalSocket> m_socket;
int m_client_id { -1 }; int m_client_id { -1 };
int m_client_pid { -1 }; int m_client_pid { -1 };
}; };

View file

@ -1,3 +0,0 @@
#pragma once
#define ObjectPtr RefPtr

View file

@ -61,7 +61,7 @@ private:
bool m_exclusive { false }; bool m_exclusive { false };
int m_auto_repeat_interval { 0 }; int m_auto_repeat_interval { 0 };
ObjectPtr<CTimer> m_auto_repeat_timer; RefPtr<CTimer> m_auto_repeat_timer;
}; };
template<> template<>

View file

@ -52,7 +52,7 @@ protected:
bool m_editable { false }; bool m_editable { false };
GModelIndex m_edit_index; GModelIndex m_edit_index;
ObjectPtr<GWidget> m_edit_widget; RefPtr<GWidget> m_edit_widget;
Rect m_edit_widget_content_rect; Rect m_edit_widget_content_rect;
private: private:

View file

@ -92,7 +92,7 @@ public:
m_label->set_text(tooltip); m_label->set_text(tooltip);
} }
ObjectPtr<GLabel> m_label; RefPtr<GLabel> m_label;
}; };
void GApplication::show_tooltip(const StringView& tooltip, const Point& screen_location) void GApplication::show_tooltip(const StringView& tooltip, const Point& screen_location)

View file

@ -36,9 +36,9 @@ protected:
virtual void resize_event(GResizeEvent&) override; virtual void resize_event(GResizeEvent&) override;
private: private:
ObjectPtr<GTextEditor> m_editor; RefPtr<GTextEditor> m_editor;
ObjectPtr<GButton> m_open_button; RefPtr<GButton> m_open_button;
ObjectPtr<GWindow> m_list_window; RefPtr<GWindow> m_list_window;
ObjectPtr<GListView> m_list_view; RefPtr<GListView> m_list_view;
bool m_only_allow_values_from_model { false }; bool m_only_allow_values_from_model { false };
}; };

View file

@ -82,7 +82,7 @@ private:
HashMap<uid_t, String> m_user_names; HashMap<uid_t, String> m_user_names;
HashMap<gid_t, String> m_group_names; HashMap<gid_t, String> m_group_names;
ObjectPtr<CNotifier> m_notifier; RefPtr<CNotifier> m_notifier;
unsigned m_thumbnail_progress { 0 }; unsigned m_thumbnail_progress { 0 };
unsigned m_thumbnail_progress_total { 0 }; unsigned m_thumbnail_progress_total { 0 };

View file

@ -42,13 +42,13 @@ private:
} }
} }
ObjectPtr<GTableView> m_view; RefPtr<GTableView> m_view;
NonnullRefPtr<GDirectoryModel> m_model; NonnullRefPtr<GDirectoryModel> m_model;
FileSystemPath m_selected_file; FileSystemPath m_selected_file;
ObjectPtr<GTextBox> m_filename_textbox; RefPtr<GTextBox> m_filename_textbox;
ObjectPtr<GLabel> m_preview_image_label; RefPtr<GLabel> m_preview_image_label;
ObjectPtr<GLabel> m_preview_name_label; RefPtr<GLabel> m_preview_name_label;
ObjectPtr<GLabel> m_preview_geometry_label; RefPtr<GLabel> m_preview_geometry_label;
Mode m_mode { Mode::Open }; Mode m_mode { Mode::Open };
}; };

View file

@ -18,7 +18,7 @@ private:
String m_prompt; String m_prompt;
String m_text_value; String m_text_value;
ObjectPtr<GButton> m_ok_button; RefPtr<GButton> m_ok_button;
ObjectPtr<GButton> m_cancel_button; RefPtr<GButton> m_cancel_button;
ObjectPtr<GTextEditor> m_text_editor; RefPtr<GTextEditor> m_text_editor;
}; };

View file

@ -62,7 +62,7 @@ void GMessageBox::build()
widget->layout()->set_margins({ 0, 15, 0, 15 }); widget->layout()->set_margins({ 0, 15, 0, 15 });
widget->layout()->set_spacing(15); widget->layout()->set_spacing(15);
ObjectPtr<GWidget> message_container = widget; RefPtr<GWidget> message_container = widget;
if (m_type != Type::None) { if (m_type != Type::None) {
message_container = GWidget::construct(widget.ptr()); message_container = GWidget::construct(widget.ptr());
message_container->set_layout(make<GBoxLayout>(Orientation::Horizontal)); message_container->set_layout(make<GBoxLayout>(Orientation::Horizontal));

View file

@ -29,7 +29,7 @@ public:
virtual void will_begin_editing() { } virtual void will_begin_editing() { }
protected: protected:
virtual ObjectPtr<GWidget> create_widget() = 0; virtual RefPtr<GWidget> create_widget() = 0;
void commit() void commit()
{ {
if (on_commit) if (on_commit)
@ -39,7 +39,7 @@ protected:
private: private:
RefPtr<GModel> m_model; RefPtr<GModel> m_model;
GModelIndex m_index; GModelIndex m_index;
ObjectPtr<GWidget> m_widget; RefPtr<GWidget> m_widget;
}; };
class GStringModelEditingDelegate : public GModelEditingDelegate { class GStringModelEditingDelegate : public GModelEditingDelegate {
@ -47,7 +47,7 @@ public:
GStringModelEditingDelegate() {} GStringModelEditingDelegate() {}
virtual ~GStringModelEditingDelegate() override {} virtual ~GStringModelEditingDelegate() override {}
virtual ObjectPtr<GWidget> create_widget() override virtual RefPtr<GWidget> create_widget() override
{ {
auto textbox = GTextBox::construct(nullptr); auto textbox = GTextBox::construct(nullptr);
textbox->on_return_pressed = [this] { textbox->on_return_pressed = [this] {

View file

@ -83,5 +83,5 @@ private:
}; };
AutomaticScrollingDirection m_automatic_scrolling_direction { AutomaticScrollingDirection::None }; AutomaticScrollingDirection m_automatic_scrolling_direction { AutomaticScrollingDirection::None };
ObjectPtr<CTimer> m_automatic_scrolling_timer; RefPtr<CTimer> m_automatic_scrolling_timer;
}; };

View file

@ -53,9 +53,9 @@ protected:
private: private:
void update_scrollbar_ranges(); void update_scrollbar_ranges();
ObjectPtr<GScrollBar> m_vertical_scrollbar; RefPtr<GScrollBar> m_vertical_scrollbar;
ObjectPtr<GScrollBar> m_horizontal_scrollbar; RefPtr<GScrollBar> m_horizontal_scrollbar;
ObjectPtr<GWidget> m_corner_widget; RefPtr<GWidget> m_corner_widget;
Size m_content_size; Size m_content_size;
Size m_size_occupied_by_fixed_elements; Size m_size_occupied_by_fixed_elements;
bool m_scrollbars_enabled { true }; bool m_scrollbars_enabled { true };

View file

@ -27,9 +27,9 @@ protected:
virtual void resize_event(GResizeEvent&) override; virtual void resize_event(GResizeEvent&) override;
private: private:
ObjectPtr<GTextEditor> m_editor; RefPtr<GTextEditor> m_editor;
ObjectPtr<GButton> m_increment_button; RefPtr<GButton> m_increment_button;
ObjectPtr<GButton> m_decrement_button; RefPtr<GButton> m_decrement_button;
int m_min { 0 }; int m_min { 0 };
int m_max { 100 }; int m_max { 100 };

View file

@ -19,5 +19,5 @@ protected:
virtual void resize_event(GResizeEvent&) override; virtual void resize_event(GResizeEvent&) override;
private: private:
ObjectPtr<GWidget> m_active_widget; RefPtr<GWidget> m_active_widget;
}; };

View file

@ -18,6 +18,6 @@ protected:
virtual void paint_event(GPaintEvent&) override; virtual void paint_event(GPaintEvent&) override;
private: private:
ObjectPtr<GLabel> m_label; RefPtr<GLabel> m_label;
ObjectPtr<GResizeCorner> m_corner; RefPtr<GResizeCorner> m_corner;
}; };

View file

@ -42,7 +42,7 @@ private:
Rect container_rect() const; Rect container_rect() const;
void update_bar(); void update_bar();
ObjectPtr<GWidget> m_active_widget; RefPtr<GWidget> m_active_widget;
struct TabData { struct TabData {
Rect rect(const Font&) const; Rect rect(const Font&) const;

View file

@ -151,7 +151,7 @@ private:
RefPtr<GraphicsBitmap> m_icon; RefPtr<GraphicsBitmap> m_icon;
int m_window_id { 0 }; int m_window_id { 0 };
float m_opacity_when_windowless { 1.0f }; float m_opacity_when_windowless { 1.0f };
ObjectPtr<GWidget> m_main_widget; RefPtr<GWidget> m_main_widget;
WeakPtr<GWidget> m_focused_widget; WeakPtr<GWidget> m_focused_widget;
WeakPtr<GWidget> m_global_cursor_tracking_widget; WeakPtr<GWidget> m_global_cursor_tracking_widget;
WeakPtr<GWidget> m_automatic_cursor_tracking_widget; WeakPtr<GWidget> m_automatic_cursor_tracking_widget;

View file

@ -12,6 +12,6 @@ public:
private: private:
CEventLoop m_event_loop; CEventLoop m_event_loop;
ObjectPtr<CLocalServer> m_server; RefPtr<CLocalServer> m_server;
ASMixer m_mixer; ASMixer m_mixer;
}; };

View file

@ -63,7 +63,7 @@ public:
private: private:
Vector<NonnullRefPtr<ASBufferQueue>> m_pending_mixing; Vector<NonnullRefPtr<ASBufferQueue>> m_pending_mixing;
ObjectPtr<CFile> m_device; RefPtr<CFile> m_device;
LibThread::Lock m_lock; LibThread::Lock m_lock;
LibThread::Thread m_sound_thread; LibThread::Thread m_sound_thread;

View file

@ -10,7 +10,7 @@
#include "Client.h" #include "Client.h"
Client::Client(int id, ObjectPtr<CTCPSocket> socket, int ptm_fd) Client::Client(int id, RefPtr<CTCPSocket> socket, int ptm_fd)
: m_id(id) : m_id(id)
, m_socket(move(socket)) , m_socket(move(socket))
, m_ptm_fd(ptm_fd) , m_ptm_fd(ptm_fd)

View file

@ -11,7 +11,7 @@
class Client : public RefCounted<Client> { class Client : public RefCounted<Client> {
public: public:
static NonnullRefPtr<Client> create(int id, ObjectPtr<CTCPSocket> socket, int ptm_fd) static NonnullRefPtr<Client> create(int id, RefPtr<CTCPSocket> socket, int ptm_fd)
{ {
return adopt(*new Client(id, move(socket), ptm_fd)); return adopt(*new Client(id, move(socket), ptm_fd));
} }
@ -19,7 +19,7 @@ public:
Function<void()> on_exit; Function<void()> on_exit;
protected: protected:
Client(int id, ObjectPtr<CTCPSocket> socket, int ptm_fd); Client(int id, RefPtr<CTCPSocket> socket, int ptm_fd);
void drain_socket(); void drain_socket();
void drain_pty(); void drain_pty();
@ -35,9 +35,9 @@ private:
// client id // client id
int m_id { 0 }; int m_id { 0 };
// client resources // client resources
ObjectPtr<CTCPSocket> m_socket; RefPtr<CTCPSocket> m_socket;
Parser m_parser; Parser m_parser;
// pty resources // pty resources
int m_ptm_fd { -1 }; int m_ptm_fd { -1 };
ObjectPtr<CNotifier> m_ptm_notifier; RefPtr<CNotifier> m_ptm_notifier;
}; };

View file

@ -46,8 +46,8 @@ private:
unsigned m_compose_count { 0 }; unsigned m_compose_count { 0 };
unsigned m_flush_count { 0 }; unsigned m_flush_count { 0 };
ObjectPtr<CTimer> m_compose_timer; RefPtr<CTimer> m_compose_timer;
ObjectPtr<CTimer> m_immediate_compose_timer; RefPtr<CTimer> m_immediate_compose_timer;
bool m_flash_flush { false }; bool m_flash_flush { false };
bool m_buffers_are_flipped { false }; bool m_buffers_are_flipped { false };
bool m_screen_can_set_buffer { false }; bool m_screen_can_set_buffer { false };

View file

@ -21,8 +21,8 @@ private:
CEventLoop m_event_loop; CEventLoop m_event_loop;
int m_keyboard_fd { -1 }; int m_keyboard_fd { -1 };
ObjectPtr<CNotifier> m_keyboard_notifier; RefPtr<CNotifier> m_keyboard_notifier;
int m_mouse_fd { -1 }; int m_mouse_fd { -1 };
ObjectPtr<CNotifier> m_mouse_notifier; RefPtr<CNotifier> m_mouse_notifier;
ObjectPtr<CLocalServer> m_server; RefPtr<CLocalServer> m_server;
}; };

View file

@ -33,7 +33,7 @@ private:
RefPtr<WSWindow> m_window; RefPtr<WSWindow> m_window;
WSCPUMonitor m_cpu_monitor; WSCPUMonitor m_cpu_monitor;
String m_username; String m_username;
ObjectPtr<CTimer> m_timer; RefPtr<CTimer> m_timer;
Vector<WeakPtr<WSMenu>> m_open_menu_stack; Vector<WeakPtr<WSMenu>> m_open_menu_stack;
}; };