diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-09-22 00:31:54 +0200 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-09-22 00:31:54 +0200 |
commit | d6abfbdc5a7838fdc8e20e43a5146968a8dbcd81 (patch) | |
tree | 3a2b7d2f2c3d5e231a391f5f86ac64aaea2c49fb /Libraries/LibCore | |
parent | bc319d9e8873734bb8e8cea3d762d7fab2ded887 (diff) | |
download | serenity-d6abfbdc5a7838fdc8e20e43a5146968a8dbcd81.zip |
LibCore: Remove ObjectPtr in favor of RefPtr
Now that CObject is fully ref-counted, just use RefPtr everywhere! :^)
Diffstat (limited to 'Libraries/LibCore')
-rw-r--r-- | Libraries/LibCore/CEventLoop.cpp | 6 | ||||
-rw-r--r-- | Libraries/LibCore/CEventLoop.h | 2 | ||||
-rw-r--r-- | Libraries/LibCore/CHttpJob.h | 2 | ||||
-rw-r--r-- | Libraries/LibCore/CHttpRequest.cpp | 2 | ||||
-rw-r--r-- | Libraries/LibCore/CHttpRequest.h | 3 | ||||
-rw-r--r-- | Libraries/LibCore/CLocalServer.cpp | 2 | ||||
-rw-r--r-- | Libraries/LibCore/CLocalServer.h | 4 | ||||
-rw-r--r-- | Libraries/LibCore/CNotifier.h | 1 | ||||
-rw-r--r-- | Libraries/LibCore/CObject.h | 1 | ||||
-rw-r--r-- | Libraries/LibCore/CSocket.h | 5 | ||||
-rw-r--r-- | Libraries/LibCore/CTCPServer.cpp | 2 | ||||
-rw-r--r-- | Libraries/LibCore/CTCPServer.h | 4 | ||||
-rw-r--r-- | Libraries/LibCore/CTimer.h | 1 | ||||
-rw-r--r-- | Libraries/LibCore/CoreIPCClient.h | 8 | ||||
-rw-r--r-- | Libraries/LibCore/CoreIPCServer.h | 4 | ||||
-rw-r--r-- | Libraries/LibCore/ObjectPtr.h | 3 |
16 files changed, 21 insertions, 29 deletions
diff --git a/Libraries/LibCore/CEventLoop.cpp b/Libraries/LibCore/CEventLoop.cpp index df05f95784..68ef3bd753 100644 --- a/Libraries/LibCore/CEventLoop.cpp +++ b/Libraries/LibCore/CEventLoop.cpp @@ -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() diff --git a/Libraries/LibCore/CEventLoop.h b/Libraries/LibCore/CEventLoop.h index 6ec33fd715..16538e2c48 100644 --- a/Libraries/LibCore/CEventLoop.h +++ b/Libraries/LibCore/CEventLoop.h @@ -87,5 +87,5 @@ private: static HashTable<CNotifier*>* s_notifiers; - static ObjectPtr<CLocalServer> s_rpc_server; + static RefPtr<CLocalServer> s_rpc_server; }; diff --git a/Libraries/LibCore/CHttpJob.h b/Libraries/LibCore/CHttpJob.h index 3e3b758977..cb0e00506c 100644 --- a/Libraries/LibCore/CHttpJob.h +++ b/Libraries/LibCore/CHttpJob.h @@ -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; diff --git a/Libraries/LibCore/CHttpRequest.cpp b/Libraries/LibCore/CHttpRequest.cpp index 4092249f0d..17537a3244 100644 --- a/Libraries/LibCore/CHttpRequest.cpp +++ b/Libraries/LibCore/CHttpRequest.cpp @@ -10,7 +10,7 @@ CHttpRequest::~CHttpRequest() { } -ObjectPtr<CNetworkJob> CHttpRequest::schedule() +RefPtr<CNetworkJob> CHttpRequest::schedule() { auto job = CHttpJob::construct(*this); job->start(); diff --git a/Libraries/LibCore/CHttpRequest.h b/Libraries/LibCore/CHttpRequest.h index 6d0d3a6259..0d73383e8c 100644 --- a/Libraries/LibCore/CHttpRequest.h +++ b/Libraries/LibCore/CHttpRequest.h @@ -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; diff --git a/Libraries/LibCore/CLocalServer.cpp b/Libraries/LibCore/CLocalServer.cpp index b70d31fd1a..b68c5381f1 100644 --- a/Libraries/LibCore/CLocalServer.cpp +++ b/Libraries/LibCore/CLocalServer.cpp @@ -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; diff --git a/Libraries/LibCore/CLocalServer.h b/Libraries/LibCore/CLocalServer.h index ca2b1099da..1e512728d8 100644 --- a/Libraries/LibCore/CLocalServer.h +++ b/Libraries/LibCore/CLocalServer.h @@ -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; }; diff --git a/Libraries/LibCore/CNotifier.h b/Libraries/LibCore/CNotifier.h index f724a588b5..bd9d407425 100644 --- a/Libraries/LibCore/CNotifier.h +++ b/Libraries/LibCore/CNotifier.h @@ -2,7 +2,6 @@ #include <AK/Function.h> #include <LibCore/CObject.h> -#include <LibCore/ObjectPtr.h> class CNotifier : public CObject { C_OBJECT(CNotifier) diff --git a/Libraries/LibCore/CObject.h b/Libraries/LibCore/CObject.h index 1c182a322f..dd036ef666 100644 --- a/Libraries/LibCore/CObject.h +++ b/Libraries/LibCore/CObject.h @@ -8,7 +8,6 @@ #include <AK/String.h> #include <AK/Vector.h> #include <AK/Weakable.h> -#include <LibCore/ObjectPtr.h> namespace AK { class JsonObject; diff --git a/Libraries/LibCore/CSocket.h b/Libraries/LibCore/CSocket.h index a6c2ef454c..563c7b5586 100644 --- a/Libraries/LibCore/CSocket.h +++ b/Libraries/LibCore/CSocket.h @@ -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; }; diff --git a/Libraries/LibCore/CTCPServer.cpp b/Libraries/LibCore/CTCPServer.cpp index 2091ee0b7f..f0705b7c0b 100644 --- a/Libraries/LibCore/CTCPServer.cpp +++ b/Libraries/LibCore/CTCPServer.cpp @@ -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; diff --git a/Libraries/LibCore/CTCPServer.h b/Libraries/LibCore/CTCPServer.h index a88960c94f..8e2b6920eb 100644 --- a/Libraries/LibCore/CTCPServer.h +++ b/Libraries/LibCore/CTCPServer.h @@ -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; }; diff --git a/Libraries/LibCore/CTimer.h b/Libraries/LibCore/CTimer.h index 2df70ee5d3..a22b725d21 100644 --- a/Libraries/LibCore/CTimer.h +++ b/Libraries/LibCore/CTimer.h @@ -2,7 +2,6 @@ #include <AK/Function.h> #include <LibCore/CObject.h> -#include <LibCore/ObjectPtr.h> class CTimer final : public CObject { C_OBJECT(CTimer) diff --git a/Libraries/LibCore/CoreIPCClient.h b/Libraries/LibCore/CoreIPCClient.h index 5845b8b1c9..a16ca22821 100644 --- a/Libraries/LibCore/CoreIPCClient.h +++ b/Libraries/LibCore/CoreIPCClient.h @@ -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 }; diff --git a/Libraries/LibCore/CoreIPCServer.h b/Libraries/LibCore/CoreIPCServer.h index f8c064e8fa..73b3130379 100644 --- a/Libraries/LibCore/CoreIPCServer.h +++ b/Libraries/LibCore/CoreIPCServer.h @@ -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 }; }; diff --git a/Libraries/LibCore/ObjectPtr.h b/Libraries/LibCore/ObjectPtr.h deleted file mode 100644 index 8490a8877e..0000000000 --- a/Libraries/LibCore/ObjectPtr.h +++ /dev/null @@ -1,3 +0,0 @@ -#pragma once - -#define ObjectPtr RefPtr |