1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 03:47:34 +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

@ -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()

View file

@ -87,5 +87,5 @@ private:
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;
ObjectPtr<CTCPSocket> m_socket;
RefPtr<CTCPSocket> m_socket;
State m_state { State::InStatus };
int m_code { -1 };
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);
job->start();

View file

@ -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;

View file

@ -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;

View file

@ -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;
};

View file

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

View file

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

View file

@ -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;
};

View file

@ -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;

View file

@ -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;
};

View file

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

View file

@ -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 };

View file

@ -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 };
};

View file

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