From 73fba22c019562687c6e14f20ca7422020f7e070 Mon Sep 17 00:00:00 2001 From: Yuri Kunde Schlesner Date: Sat, 13 Dec 2014 21:16:13 -0200 Subject: Rename ObjectPool to HandleTable --- src/core/hle/service/fs/archive.cpp | 8 ++++---- src/core/hle/service/service.cpp | 4 ++-- src/core/hle/service/service.h | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) (limited to 'src/core/hle/service') diff --git a/src/core/hle/service/fs/archive.cpp b/src/core/hle/service/fs/archive.cpp index 98db02f15..5746b58e5 100644 --- a/src/core/hle/service/fs/archive.cpp +++ b/src/core/hle/service/fs/archive.cpp @@ -133,7 +133,7 @@ public: case FileCommand::Close: { LOG_TRACE(Service_FS, "Close %s %s", GetTypeName().c_str(), GetName().c_str()); - Kernel::g_object_pool.Destroy(GetHandle()); + Kernel::g_handle_table.Destroy(GetHandle()); break; } @@ -189,7 +189,7 @@ public: case DirectoryCommand::Close: { LOG_TRACE(Service_FS, "Close %s %s", GetTypeName().c_str(), GetName().c_str()); - Kernel::g_object_pool.Destroy(GetHandle()); + Kernel::g_handle_table.Destroy(GetHandle()); break; } @@ -283,7 +283,7 @@ ResultVal OpenFileFromArchive(ArchiveHandle archive_handle, const FileSy } auto file = Common::make_unique(std::move(backend), path); - Handle handle = Kernel::g_object_pool.Create(file.release()); + Handle handle = Kernel::g_handle_table.Create(file.release()); return MakeResult(handle); } @@ -388,7 +388,7 @@ ResultVal OpenDirectoryFromArchive(ArchiveHandle archive_handle, const F } auto directory = Common::make_unique(std::move(backend), path); - Handle handle = Kernel::g_object_pool.Create(directory.release()); + Handle handle = Kernel::g_handle_table.Create(directory.release()); return MakeResult(handle); } diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp index 44e4fbcb2..e9a7973b3 100644 --- a/src/core/hle/service/service.cpp +++ b/src/core/hle/service/service.cpp @@ -56,7 +56,7 @@ Manager::~Manager() { /// Add a service to the manager (does not create it though) void Manager::AddService(Interface* service) { - m_port_map[service->GetPortName()] = Kernel::g_object_pool.Create(service); + m_port_map[service->GetPortName()] = Kernel::g_handle_table.Create(service); m_services.push_back(service); } @@ -70,7 +70,7 @@ void Manager::DeleteService(const std::string& port_name) { /// Get a Service Interface from its Handle Interface* Manager::FetchFromHandle(Handle handle) { - return Kernel::g_object_pool.Get(handle); + return Kernel::g_handle_table.Get(handle); } /// Get a Service Interface from its port diff --git a/src/core/hle/service/service.h b/src/core/hle/service/service.h index 0616822fa..9d5828fd0 100644 --- a/src/core/hle/service/service.h +++ b/src/core/hle/service/service.h @@ -54,7 +54,7 @@ public: /// Allocates a new handle for the service Handle CreateHandle(Kernel::Object *obj) { - Handle handle = Kernel::g_object_pool.Create(obj); + Handle handle = Kernel::g_handle_table.Create(obj); m_handles.push_back(handle); return handle; } @@ -62,7 +62,7 @@ public: /// Frees a handle from the service template void DeleteHandle(const Handle handle) { - Kernel::g_object_pool.Destroy(handle); + Kernel::g_handle_table.Destroy(handle); m_handles.erase(std::remove(m_handles.begin(), m_handles.end(), handle), m_handles.end()); } -- cgit v1.2.3 From 7e2903cb74050d846f2da951dff7e84aee13761b Mon Sep 17 00:00:00 2001 From: Yuri Kunde Schlesner Date: Sun, 21 Dec 2014 10:04:08 -0200 Subject: Kernel: New handle manager This handle manager more closely mirrors the behaviour of the CTR-OS one. In addition object ref-counts and support for DuplicateHandle have been added. Note that support for DuplicateHandle is still experimental, since parts of the kernel still use Handles internally, which will likely cause troubles if two different handles to the same object are used to e.g. wait on a synchronization primitive. --- src/core/hle/service/fs/archive.cpp | 10 ++++++---- src/core/hle/service/service.cpp | 3 ++- src/core/hle/service/service.h | 5 +++-- 3 files changed, 11 insertions(+), 7 deletions(-) (limited to 'src/core/hle/service') diff --git a/src/core/hle/service/fs/archive.cpp b/src/core/hle/service/fs/archive.cpp index 5746b58e5..487bf3aa7 100644 --- a/src/core/hle/service/fs/archive.cpp +++ b/src/core/hle/service/fs/archive.cpp @@ -133,7 +133,7 @@ public: case FileCommand::Close: { LOG_TRACE(Service_FS, "Close %s %s", GetTypeName().c_str(), GetName().c_str()); - Kernel::g_handle_table.Destroy(GetHandle()); + backend->Close(); break; } @@ -189,7 +189,7 @@ public: case DirectoryCommand::Close: { LOG_TRACE(Service_FS, "Close %s %s", GetTypeName().c_str(), GetName().c_str()); - Kernel::g_handle_table.Destroy(GetHandle()); + backend->Close(); break; } @@ -283,7 +283,8 @@ ResultVal OpenFileFromArchive(ArchiveHandle archive_handle, const FileSy } auto file = Common::make_unique(std::move(backend), path); - Handle handle = Kernel::g_handle_table.Create(file.release()); + // TOOD(yuriks): Fix error reporting + Handle handle = Kernel::g_handle_table.Create(file.release()).ValueOr(INVALID_HANDLE); return MakeResult(handle); } @@ -388,7 +389,8 @@ ResultVal OpenDirectoryFromArchive(ArchiveHandle archive_handle, const F } auto directory = Common::make_unique(std::move(backend), path); - Handle handle = Kernel::g_handle_table.Create(directory.release()); + // TOOD(yuriks): Fix error reporting + Handle handle = Kernel::g_handle_table.Create(directory.release()).ValueOr(INVALID_HANDLE); return MakeResult(handle); } diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp index e9a7973b3..0f3cc2aa8 100644 --- a/src/core/hle/service/service.cpp +++ b/src/core/hle/service/service.cpp @@ -56,7 +56,8 @@ Manager::~Manager() { /// Add a service to the manager (does not create it though) void Manager::AddService(Interface* service) { - m_port_map[service->GetPortName()] = Kernel::g_handle_table.Create(service); + // TOOD(yuriks): Fix error reporting + m_port_map[service->GetPortName()] = Kernel::g_handle_table.Create(service).ValueOr(INVALID_HANDLE); m_services.push_back(service); } diff --git a/src/core/hle/service/service.h b/src/core/hle/service/service.h index 9d5828fd0..28b4ccd17 100644 --- a/src/core/hle/service/service.h +++ b/src/core/hle/service/service.h @@ -54,7 +54,8 @@ public: /// Allocates a new handle for the service Handle CreateHandle(Kernel::Object *obj) { - Handle handle = Kernel::g_handle_table.Create(obj); + // TODO(yuriks): Fix error reporting + Handle handle = Kernel::g_handle_table.Create(obj).ValueOr(INVALID_HANDLE); m_handles.push_back(handle); return handle; } @@ -62,7 +63,7 @@ public: /// Frees a handle from the service template void DeleteHandle(const Handle handle) { - Kernel::g_handle_table.Destroy(handle); + Kernel::g_handle_table.Close(handle); m_handles.erase(std::remove(m_handles.begin(), m_handles.end(), handle), m_handles.end()); } -- cgit v1.2.3