1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 05:27:45 +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;
Keypad m_keypad;
ObjectPtr<GTextBox> m_entry;
ObjectPtr<GLabel> m_label;
RefPtr<GTextBox> m_entry;
RefPtr<GLabel> m_label;
ObjectPtr<GButton> m_digit_button[10];
ObjectPtr<GButton> m_mem_add_button;
ObjectPtr<GButton> m_mem_save_button;
ObjectPtr<GButton> m_mem_recall_button;
ObjectPtr<GButton> m_mem_clear_button;
ObjectPtr<GButton> m_clear_button;
ObjectPtr<GButton> m_clear_error_button;
ObjectPtr<GButton> m_backspace_button;
ObjectPtr<GButton> m_decimal_point_button;
ObjectPtr<GButton> m_sign_button;
ObjectPtr<GButton> m_add_button;
ObjectPtr<GButton> m_subtract_button;
ObjectPtr<GButton> m_multiply_button;
ObjectPtr<GButton> m_divide_button;
ObjectPtr<GButton> m_sqrt_button;
ObjectPtr<GButton> m_inverse_button;
ObjectPtr<GButton> m_percent_button;
ObjectPtr<GButton> m_equals_button;
RefPtr<GButton> m_digit_button[10];
RefPtr<GButton> m_mem_add_button;
RefPtr<GButton> m_mem_save_button;
RefPtr<GButton> m_mem_recall_button;
RefPtr<GButton> m_mem_clear_button;
RefPtr<GButton> m_clear_button;
RefPtr<GButton> m_clear_error_button;
RefPtr<GButton> m_backspace_button;
RefPtr<GButton> m_decimal_point_button;
RefPtr<GButton> m_sign_button;
RefPtr<GButton> m_add_button;
RefPtr<GButton> m_subtract_button;
RefPtr<GButton> m_multiply_button;
RefPtr<GButton> m_divide_button;
RefPtr<GButton> m_sqrt_button;
RefPtr<GButton> m_inverse_button;
RefPtr<GButton> m_percent_button;
RefPtr<GButton> m_equals_button;
};

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -19,7 +19,7 @@ public:
private:
virtual const char* class_name() const override { return "SprayTool"; }
void paint_it();
ObjectPtr<CTimer> m_timer;
RefPtr<CTimer> m_timer;
Point m_last_pos;
Color m_color;
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_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);
container->set_layout(make<GBoxLayout>(Orientation::Horizontal));
container->set_size_policy(SizePolicy::Fixed, SizePolicy::Fixed);

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -39,9 +39,9 @@ static String human_readable_size(u32 size)
return String::format("%u GB", size / GB);
}
static ObjectPtr<GWidget> build_file_systems_tab();
static ObjectPtr<GWidget> build_pci_devices_tab();
static ObjectPtr<GWidget> build_devices_tab();
static RefPtr<GWidget> build_file_systems_tab();
static RefPtr<GWidget> build_pci_devices_tab();
static RefPtr<GWidget> build_devices_tab();
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();
fs_widget->set_layout(make<GBoxLayout>(Orientation::Vertical));
@ -299,7 +299,7 @@ ObjectPtr<GWidget> build_file_systems_tab()
return fs_widget;
}
ObjectPtr<GWidget> build_pci_devices_tab()
RefPtr<GWidget> build_pci_devices_tab()
{
auto pci_widget = GWidget::construct();
pci_widget->set_layout(make<GBoxLayout>(Orientation::Vertical));
@ -353,7 +353,7 @@ ObjectPtr<GWidget> build_pci_devices_tab()
return pci_widget;
}
ObjectPtr<GWidget> build_devices_tab()
RefPtr<GWidget> build_devices_tab()
{
auto devices_widget = GWidget::construct();
devices_widget->set_layout(make<GBoxLayout>(Orientation::Vertical));

View file

@ -88,7 +88,7 @@ private:
bool m_in_active_window { false };
ObjectPtr<CNotifier> m_notifier;
RefPtr<CNotifier> m_notifier;
u8 m_opacity { 255 };
bool m_needs_background_fill { true };
@ -96,9 +96,9 @@ private:
int m_glyph_width { 0 };
ObjectPtr<CTimer> m_cursor_blink_timer;
ObjectPtr<CTimer> m_visual_beep_timer;
RefPtr<CTimer> m_cursor_blink_timer;
RefPtr<CTimer> m_visual_beep_timer;
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();
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"));
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);
terminal->set_opacity(new_opacity);

View file

@ -24,7 +24,7 @@ private:
void set_path(const FileSystemPath& file);
void update_title();
ObjectPtr<GTextEditor> m_editor;
RefPtr<GTextEditor> m_editor;
String m_path;
String m_name;
String m_extension;
@ -37,12 +37,12 @@ private:
RefPtr<GAction> m_find_next_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_next_button { nullptr };
ObjectPtr<GWidget> m_find_widget;
RefPtr<GWidget> m_find_widget;
bool m_document_dirty { false };
};