mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 15:07: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:
parent
bc319d9e88
commit
d6abfbdc5a
71 changed files with 146 additions and 156 deletions
|
@ -29,7 +29,7 @@ public:
|
|||
|
||||
private:
|
||||
bool parse_header();
|
||||
ObjectPtr<CFile> m_file;
|
||||
RefPtr<CFile> m_file;
|
||||
String m_error_string;
|
||||
|
||||
u32 m_sample_rate { 0 };
|
||||
|
|
|
@ -29,12 +29,12 @@ HashMap<int, NonnullOwnPtr<CEventLoop::EventLoopTimer>>* CEventLoop::s_timers;
|
|||
HashTable<CNotifier*>* CEventLoop::s_notifiers;
|
||||
int CEventLoop::s_next_timer_id = 1;
|
||||
int CEventLoop::s_wake_pipe_fds[2];
|
||||
ObjectPtr<CLocalServer> CEventLoop::s_rpc_server;
|
||||
RefPtr<CLocalServer> CEventLoop::s_rpc_server;
|
||||
|
||||
class RPCClient : public CObject {
|
||||
C_OBJECT(RPCClient)
|
||||
public:
|
||||
explicit RPCClient(ObjectPtr<CLocalSocket> socket)
|
||||
explicit RPCClient(RefPtr<CLocalSocket> socket)
|
||||
: m_socket(move(socket))
|
||||
{
|
||||
add_child(*m_socket);
|
||||
|
@ -123,7 +123,7 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
ObjectPtr<CLocalSocket> m_socket;
|
||||
RefPtr<CLocalSocket> m_socket;
|
||||
};
|
||||
|
||||
CEventLoop::CEventLoop()
|
||||
|
|
|
@ -87,5 +87,5 @@ private:
|
|||
|
||||
static HashTable<CNotifier*>* s_notifiers;
|
||||
|
||||
static ObjectPtr<CLocalServer> s_rpc_server;
|
||||
static RefPtr<CLocalServer> s_rpc_server;
|
||||
};
|
||||
|
|
|
@ -27,7 +27,7 @@ private:
|
|||
};
|
||||
|
||||
CHttpRequest m_request;
|
||||
ObjectPtr<CTCPSocket> m_socket;
|
||||
RefPtr<CTCPSocket> m_socket;
|
||||
State m_state { State::InStatus };
|
||||
int m_code { -1 };
|
||||
HashMap<String, String> m_headers;
|
||||
|
|
|
@ -10,7 +10,7 @@ CHttpRequest::~CHttpRequest()
|
|||
{
|
||||
}
|
||||
|
||||
ObjectPtr<CNetworkJob> CHttpRequest::schedule()
|
||||
RefPtr<CNetworkJob> CHttpRequest::schedule()
|
||||
{
|
||||
auto job = CHttpJob::construct(*this);
|
||||
job->start();
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
#include <AK/String.h>
|
||||
#include <AK/URL.h>
|
||||
#include <LibCore/ObjectPtr.h>
|
||||
|
||||
class CNetworkJob;
|
||||
|
||||
|
@ -27,7 +26,7 @@ public:
|
|||
String method_name() const;
|
||||
ByteBuffer to_raw_request() const;
|
||||
|
||||
ObjectPtr<CNetworkJob> schedule();
|
||||
RefPtr<CNetworkJob> schedule();
|
||||
|
||||
private:
|
||||
URL m_url;
|
||||
|
|
|
@ -39,7 +39,7 @@ bool CLocalServer::listen(const String& address)
|
|||
return true;
|
||||
}
|
||||
|
||||
ObjectPtr<CLocalSocket> CLocalServer::accept()
|
||||
RefPtr<CLocalSocket> CLocalServer::accept()
|
||||
{
|
||||
ASSERT(m_listening);
|
||||
sockaddr_un un;
|
||||
|
|
|
@ -13,7 +13,7 @@ public:
|
|||
bool is_listening() const { return m_listening; }
|
||||
bool listen(const String& address);
|
||||
|
||||
ObjectPtr<CLocalSocket> accept();
|
||||
RefPtr<CLocalSocket> accept();
|
||||
|
||||
Function<void()> on_ready_to_accept;
|
||||
|
||||
|
@ -22,5 +22,5 @@ private:
|
|||
|
||||
int m_fd { -1 };
|
||||
bool m_listening { false };
|
||||
ObjectPtr<CNotifier> m_notifier;
|
||||
RefPtr<CNotifier> m_notifier;
|
||||
};
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
#include <AK/Function.h>
|
||||
#include <LibCore/CObject.h>
|
||||
#include <LibCore/ObjectPtr.h>
|
||||
|
||||
class CNotifier : public CObject {
|
||||
C_OBJECT(CNotifier)
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
#include <AK/String.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <AK/Weakable.h>
|
||||
#include <LibCore/ObjectPtr.h>
|
||||
|
||||
namespace AK {
|
||||
class JsonObject;
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
#include <LibCore/CIODevice.h>
|
||||
#include <LibCore/CSocketAddress.h>
|
||||
#include <LibCore/ObjectPtr.h>
|
||||
|
||||
class CNotifier;
|
||||
|
||||
|
@ -54,6 +53,6 @@ private:
|
|||
bool common_connect(const struct sockaddr*, socklen_t);
|
||||
|
||||
Type m_type { Type::Invalid };
|
||||
ObjectPtr<CNotifier> m_notifier;
|
||||
ObjectPtr<CNotifier> m_read_notifier;
|
||||
RefPtr<CNotifier> m_notifier;
|
||||
RefPtr<CNotifier> m_read_notifier;
|
||||
};
|
||||
|
|
|
@ -40,7 +40,7 @@ bool CTCPServer::listen(const IPv4Address& address, u16 port)
|
|||
return true;
|
||||
}
|
||||
|
||||
ObjectPtr<CTCPSocket> CTCPServer::accept()
|
||||
RefPtr<CTCPSocket> CTCPServer::accept()
|
||||
{
|
||||
ASSERT(m_listening);
|
||||
sockaddr_in in;
|
||||
|
|
|
@ -14,7 +14,7 @@ public:
|
|||
bool is_listening() const { return m_listening; }
|
||||
bool listen(const IPv4Address& address, u16 port);
|
||||
|
||||
ObjectPtr<CTCPSocket> accept();
|
||||
RefPtr<CTCPSocket> accept();
|
||||
|
||||
Function<void()> on_ready_to_accept;
|
||||
|
||||
|
@ -23,5 +23,5 @@ private:
|
|||
|
||||
int m_fd { -1 };
|
||||
bool m_listening { false };
|
||||
ObjectPtr<CNotifier> m_notifier;
|
||||
RefPtr<CNotifier> m_notifier;
|
||||
};
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
#include <AK/Function.h>
|
||||
#include <LibCore/CObject.h>
|
||||
#include <LibCore/ObjectPtr.h>
|
||||
|
||||
class CTimer final : public CObject {
|
||||
C_OBJECT(CTimer)
|
||||
|
|
|
@ -229,8 +229,8 @@ namespace Client {
|
|||
}
|
||||
}
|
||||
|
||||
ObjectPtr<CLocalSocket> m_connection;
|
||||
ObjectPtr<CNotifier> m_notifier;
|
||||
RefPtr<CLocalSocket> m_connection;
|
||||
RefPtr<CNotifier> m_notifier;
|
||||
Vector<IncomingMessageBundle> m_unprocessed_bundles;
|
||||
int m_server_pid { -1 };
|
||||
int m_my_client_id { -1 };
|
||||
|
@ -372,8 +372,8 @@ namespace Client {
|
|||
}
|
||||
}
|
||||
|
||||
ObjectPtr<CLocalSocket> m_connection;
|
||||
ObjectPtr<CNotifier> m_notifier;
|
||||
RefPtr<CLocalSocket> m_connection;
|
||||
RefPtr<CNotifier> m_notifier;
|
||||
Vector<OwnPtr<IMessage>> m_unprocessed_messages;
|
||||
int m_server_pid { -1 };
|
||||
int m_my_client_id { -1 };
|
||||
|
|
|
@ -203,7 +203,7 @@ namespace Server {
|
|||
virtual bool handle_message(const ClientMessage&, const ByteBuffer&& = {}) = 0;
|
||||
|
||||
private:
|
||||
ObjectPtr<CLocalSocket> m_socket;
|
||||
RefPtr<CLocalSocket> m_socket;
|
||||
int m_client_id { -1 };
|
||||
int m_client_pid { -1 };
|
||||
};
|
||||
|
@ -311,7 +311,7 @@ namespace Server {
|
|||
|
||||
private:
|
||||
Endpoint& m_endpoint;
|
||||
ObjectPtr<CLocalSocket> m_socket;
|
||||
RefPtr<CLocalSocket> m_socket;
|
||||
int m_client_id { -1 };
|
||||
int m_client_pid { -1 };
|
||||
};
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
#define ObjectPtr RefPtr
|
|
@ -61,7 +61,7 @@ private:
|
|||
bool m_exclusive { false };
|
||||
|
||||
int m_auto_repeat_interval { 0 };
|
||||
ObjectPtr<CTimer> m_auto_repeat_timer;
|
||||
RefPtr<CTimer> m_auto_repeat_timer;
|
||||
};
|
||||
|
||||
template<>
|
||||
|
|
|
@ -52,7 +52,7 @@ protected:
|
|||
|
||||
bool m_editable { false };
|
||||
GModelIndex m_edit_index;
|
||||
ObjectPtr<GWidget> m_edit_widget;
|
||||
RefPtr<GWidget> m_edit_widget;
|
||||
Rect m_edit_widget_content_rect;
|
||||
|
||||
private:
|
||||
|
|
|
@ -92,7 +92,7 @@ public:
|
|||
m_label->set_text(tooltip);
|
||||
}
|
||||
|
||||
ObjectPtr<GLabel> m_label;
|
||||
RefPtr<GLabel> m_label;
|
||||
};
|
||||
|
||||
void GApplication::show_tooltip(const StringView& tooltip, const Point& screen_location)
|
||||
|
|
|
@ -36,9 +36,9 @@ protected:
|
|||
virtual void resize_event(GResizeEvent&) override;
|
||||
|
||||
private:
|
||||
ObjectPtr<GTextEditor> m_editor;
|
||||
ObjectPtr<GButton> m_open_button;
|
||||
ObjectPtr<GWindow> m_list_window;
|
||||
ObjectPtr<GListView> m_list_view;
|
||||
RefPtr<GTextEditor> m_editor;
|
||||
RefPtr<GButton> m_open_button;
|
||||
RefPtr<GWindow> m_list_window;
|
||||
RefPtr<GListView> m_list_view;
|
||||
bool m_only_allow_values_from_model { false };
|
||||
};
|
||||
|
|
|
@ -82,7 +82,7 @@ private:
|
|||
HashMap<uid_t, String> m_user_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_total { 0 };
|
||||
|
|
|
@ -42,13 +42,13 @@ private:
|
|||
}
|
||||
}
|
||||
|
||||
ObjectPtr<GTableView> m_view;
|
||||
RefPtr<GTableView> m_view;
|
||||
NonnullRefPtr<GDirectoryModel> m_model;
|
||||
FileSystemPath m_selected_file;
|
||||
|
||||
ObjectPtr<GTextBox> m_filename_textbox;
|
||||
ObjectPtr<GLabel> m_preview_image_label;
|
||||
ObjectPtr<GLabel> m_preview_name_label;
|
||||
ObjectPtr<GLabel> m_preview_geometry_label;
|
||||
RefPtr<GTextBox> m_filename_textbox;
|
||||
RefPtr<GLabel> m_preview_image_label;
|
||||
RefPtr<GLabel> m_preview_name_label;
|
||||
RefPtr<GLabel> m_preview_geometry_label;
|
||||
Mode m_mode { Mode::Open };
|
||||
};
|
||||
|
|
|
@ -18,7 +18,7 @@ private:
|
|||
String m_prompt;
|
||||
String m_text_value;
|
||||
|
||||
ObjectPtr<GButton> m_ok_button;
|
||||
ObjectPtr<GButton> m_cancel_button;
|
||||
ObjectPtr<GTextEditor> m_text_editor;
|
||||
RefPtr<GButton> m_ok_button;
|
||||
RefPtr<GButton> m_cancel_button;
|
||||
RefPtr<GTextEditor> m_text_editor;
|
||||
};
|
||||
|
|
|
@ -62,7 +62,7 @@ void GMessageBox::build()
|
|||
widget->layout()->set_margins({ 0, 15, 0, 15 });
|
||||
widget->layout()->set_spacing(15);
|
||||
|
||||
ObjectPtr<GWidget> message_container = widget;
|
||||
RefPtr<GWidget> message_container = widget;
|
||||
if (m_type != Type::None) {
|
||||
message_container = GWidget::construct(widget.ptr());
|
||||
message_container->set_layout(make<GBoxLayout>(Orientation::Horizontal));
|
||||
|
|
|
@ -29,7 +29,7 @@ public:
|
|||
virtual void will_begin_editing() { }
|
||||
|
||||
protected:
|
||||
virtual ObjectPtr<GWidget> create_widget() = 0;
|
||||
virtual RefPtr<GWidget> create_widget() = 0;
|
||||
void commit()
|
||||
{
|
||||
if (on_commit)
|
||||
|
@ -39,7 +39,7 @@ protected:
|
|||
private:
|
||||
RefPtr<GModel> m_model;
|
||||
GModelIndex m_index;
|
||||
ObjectPtr<GWidget> m_widget;
|
||||
RefPtr<GWidget> m_widget;
|
||||
};
|
||||
|
||||
class GStringModelEditingDelegate : public GModelEditingDelegate {
|
||||
|
@ -47,7 +47,7 @@ public:
|
|||
GStringModelEditingDelegate() {}
|
||||
virtual ~GStringModelEditingDelegate() override {}
|
||||
|
||||
virtual ObjectPtr<GWidget> create_widget() override
|
||||
virtual RefPtr<GWidget> create_widget() override
|
||||
{
|
||||
auto textbox = GTextBox::construct(nullptr);
|
||||
textbox->on_return_pressed = [this] {
|
||||
|
|
|
@ -83,5 +83,5 @@ private:
|
|||
};
|
||||
|
||||
AutomaticScrollingDirection m_automatic_scrolling_direction { AutomaticScrollingDirection::None };
|
||||
ObjectPtr<CTimer> m_automatic_scrolling_timer;
|
||||
RefPtr<CTimer> m_automatic_scrolling_timer;
|
||||
};
|
||||
|
|
|
@ -53,9 +53,9 @@ protected:
|
|||
private:
|
||||
void update_scrollbar_ranges();
|
||||
|
||||
ObjectPtr<GScrollBar> m_vertical_scrollbar;
|
||||
ObjectPtr<GScrollBar> m_horizontal_scrollbar;
|
||||
ObjectPtr<GWidget> m_corner_widget;
|
||||
RefPtr<GScrollBar> m_vertical_scrollbar;
|
||||
RefPtr<GScrollBar> m_horizontal_scrollbar;
|
||||
RefPtr<GWidget> m_corner_widget;
|
||||
Size m_content_size;
|
||||
Size m_size_occupied_by_fixed_elements;
|
||||
bool m_scrollbars_enabled { true };
|
||||
|
|
|
@ -27,9 +27,9 @@ protected:
|
|||
virtual void resize_event(GResizeEvent&) override;
|
||||
|
||||
private:
|
||||
ObjectPtr<GTextEditor> m_editor;
|
||||
ObjectPtr<GButton> m_increment_button;
|
||||
ObjectPtr<GButton> m_decrement_button;
|
||||
RefPtr<GTextEditor> m_editor;
|
||||
RefPtr<GButton> m_increment_button;
|
||||
RefPtr<GButton> m_decrement_button;
|
||||
|
||||
int m_min { 0 };
|
||||
int m_max { 100 };
|
||||
|
|
|
@ -19,5 +19,5 @@ protected:
|
|||
virtual void resize_event(GResizeEvent&) override;
|
||||
|
||||
private:
|
||||
ObjectPtr<GWidget> m_active_widget;
|
||||
RefPtr<GWidget> m_active_widget;
|
||||
};
|
||||
|
|
|
@ -18,6 +18,6 @@ protected:
|
|||
virtual void paint_event(GPaintEvent&) override;
|
||||
|
||||
private:
|
||||
ObjectPtr<GLabel> m_label;
|
||||
ObjectPtr<GResizeCorner> m_corner;
|
||||
RefPtr<GLabel> m_label;
|
||||
RefPtr<GResizeCorner> m_corner;
|
||||
};
|
||||
|
|
|
@ -42,7 +42,7 @@ private:
|
|||
Rect container_rect() const;
|
||||
void update_bar();
|
||||
|
||||
ObjectPtr<GWidget> m_active_widget;
|
||||
RefPtr<GWidget> m_active_widget;
|
||||
|
||||
struct TabData {
|
||||
Rect rect(const Font&) const;
|
||||
|
|
|
@ -151,7 +151,7 @@ private:
|
|||
RefPtr<GraphicsBitmap> m_icon;
|
||||
int m_window_id { 0 };
|
||||
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_global_cursor_tracking_widget;
|
||||
WeakPtr<GWidget> m_automatic_cursor_tracking_widget;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue