From 9046d4a5485452802b756869b7d27056ba9ea9d7 Mon Sep 17 00:00:00 2001 From: bunnei Date: Sun, 24 Nov 2019 20:15:51 -0500 Subject: kernel: Replace usage of boost::intrusive_ptr with std::shared_ptr for kernel objects. (#3154) * kernel: Replace usage of boost::intrusive_ptr with std::shared_ptr for kernel objects. - See https://github.com/citra-emu/citra/pull/4710 for details. --- src/core/hle/kernel/hle_ipc.h | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) (limited to 'src/core/hle/kernel/hle_ipc.h') diff --git a/src/core/hle/kernel/hle_ipc.h b/src/core/hle/kernel/hle_ipc.h index ccf5e56aa..dab37ba0d 100644 --- a/src/core/hle/kernel/hle_ipc.h +++ b/src/core/hle/kernel/hle_ipc.h @@ -5,6 +5,7 @@ #pragma once #include +#include #include #include #include @@ -60,20 +61,20 @@ public: * associated ServerSession alive for the duration of the connection. * @param server_session Owning pointer to the ServerSession associated with the connection. */ - void ClientConnected(SharedPtr server_session); + void ClientConnected(std::shared_ptr server_session); /** * Signals that a client has just disconnected from this HLE handler and releases the * associated ServerSession. * @param server_session ServerSession associated with the connection. */ - void ClientDisconnected(const SharedPtr& server_session); + void ClientDisconnected(const std::shared_ptr& server_session); protected: /// List of sessions that are connected to this handler. /// A ServerSession whose server endpoint is an HLE implementation is kept alive by this list /// for the duration of the connection. - std::vector> connected_sessions; + std::vector> connected_sessions; }; /** @@ -97,7 +98,8 @@ protected: */ class HLERequestContext { public: - explicit HLERequestContext(SharedPtr session, SharedPtr thread); + explicit HLERequestContext(std::shared_ptr session, + std::shared_ptr thread); ~HLERequestContext(); /// Returns a pointer to the IPC command buffer for this request. @@ -109,12 +111,12 @@ public: * Returns the session through which this request was made. This can be used as a map key to * access per-client data on services. */ - const SharedPtr& Session() const { + const std::shared_ptr& Session() const { return server_session; } - using WakeupCallback = std::function thread, HLERequestContext& context, - ThreadWakeupReason reason)>; + using WakeupCallback = std::function thread, HLERequestContext& context, ThreadWakeupReason reason)>; /** * Puts the specified guest thread to sleep until the returned event is signaled or until the @@ -129,9 +131,9 @@ public: * created. * @returns Event that when signaled will resume the thread and call the callback function. */ - SharedPtr SleepClientThread(const std::string& reason, u64 timeout, - WakeupCallback&& callback, - SharedPtr writable_event = nullptr); + std::shared_ptr SleepClientThread( + const std::string& reason, u64 timeout, WakeupCallback&& callback, + std::shared_ptr writable_event = nullptr); /// Populates this context with data from the requesting process/thread. ResultCode PopulateFromIncomingCommandBuffer(const HandleTable& handle_table, @@ -209,20 +211,20 @@ public: std::size_t GetWriteBufferSize(int buffer_index = 0) const; template - SharedPtr GetCopyObject(std::size_t index) { + std::shared_ptr GetCopyObject(std::size_t index) { return DynamicObjectCast(copy_objects.at(index)); } template - SharedPtr GetMoveObject(std::size_t index) { + std::shared_ptr GetMoveObject(std::size_t index) { return DynamicObjectCast(move_objects.at(index)); } - void AddMoveObject(SharedPtr object) { + void AddMoveObject(std::shared_ptr object) { move_objects.emplace_back(std::move(object)); } - void AddCopyObject(SharedPtr object) { + void AddCopyObject(std::shared_ptr object) { copy_objects.emplace_back(std::move(object)); } @@ -266,11 +268,11 @@ private: void ParseCommandBuffer(const HandleTable& handle_table, u32_le* src_cmdbuf, bool incoming); std::array cmd_buf; - SharedPtr server_session; - SharedPtr thread; + std::shared_ptr server_session; + std::shared_ptr thread; // TODO(yuriks): Check common usage of this and optimize size accordingly - boost::container::small_vector, 8> move_objects; - boost::container::small_vector, 8> copy_objects; + boost::container::small_vector, 8> move_objects; + boost::container::small_vector, 8> copy_objects; boost::container::small_vector, 8> domain_objects; std::optional command_header; -- cgit v1.2.3