mirror of
https://github.com/yuzu-emu/yuzu-android.git
synced 2024-11-26 07:55:43 +01:00
core: hle: kernel: Remove server session tracking.
- These are now allocated/managed by emulated memory, so we do not need to track and free them on shutdown.
This commit is contained in:
parent
0defac2f2a
commit
51589c5e21
@ -53,9 +53,6 @@ bool SessionRequestManager::HasSessionRequestHandler(const HLERequestContext& co
|
|||||||
|
|
||||||
void SessionRequestHandler::ClientConnected(KServerSession* session) {
|
void SessionRequestHandler::ClientConnected(KServerSession* session) {
|
||||||
session->ClientConnected(shared_from_this());
|
session->ClientConnected(shared_from_this());
|
||||||
|
|
||||||
// Ensure our server session is tracked globally.
|
|
||||||
kernel.RegisterServerSession(session);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SessionRequestHandler::ClientDisconnected(KServerSession* session) {
|
void SessionRequestHandler::ClientDisconnected(KServerSession* session) {
|
||||||
|
@ -27,10 +27,7 @@ namespace Kernel {
|
|||||||
|
|
||||||
KServerSession::KServerSession(KernelCore& kernel_) : KSynchronizationObject{kernel_} {}
|
KServerSession::KServerSession(KernelCore& kernel_) : KSynchronizationObject{kernel_} {}
|
||||||
|
|
||||||
KServerSession::~KServerSession() {
|
KServerSession::~KServerSession() = default;
|
||||||
// Ensure that the global list tracking server sessions does not hold on to a reference.
|
|
||||||
kernel.UnregisterServerSession(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
void KServerSession::Initialize(KSession* parent_session_, std::string&& name_,
|
void KServerSession::Initialize(KSession* parent_session_, std::string&& name_,
|
||||||
std::shared_ptr<SessionRequestManager> manager_) {
|
std::shared_ptr<SessionRequestManager> manager_) {
|
||||||
|
@ -107,16 +107,6 @@ struct KernelCore::Impl {
|
|||||||
for (auto* server_port : server_ports_) {
|
for (auto* server_port : server_ports_) {
|
||||||
server_port->Close();
|
server_port->Close();
|
||||||
}
|
}
|
||||||
// Close all open server sessions.
|
|
||||||
std::unordered_set<KServerSession*> server_sessions_;
|
|
||||||
{
|
|
||||||
std::lock_guard lk(server_sessions_lock);
|
|
||||||
server_sessions_ = server_sessions;
|
|
||||||
server_sessions.clear();
|
|
||||||
}
|
|
||||||
for (auto* server_session : server_sessions_) {
|
|
||||||
server_session->Close();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Ensure that the object list container is finalized and properly shutdown.
|
// Ensure that the object list container is finalized and properly shutdown.
|
||||||
object_list_container.Finalize();
|
object_list_container.Finalize();
|
||||||
@ -697,7 +687,6 @@ struct KernelCore::Impl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::mutex server_ports_lock;
|
std::mutex server_ports_lock;
|
||||||
std::mutex server_sessions_lock;
|
|
||||||
std::mutex registered_objects_lock;
|
std::mutex registered_objects_lock;
|
||||||
std::mutex registered_in_use_objects_lock;
|
std::mutex registered_in_use_objects_lock;
|
||||||
|
|
||||||
@ -728,7 +717,6 @@ struct KernelCore::Impl {
|
|||||||
std::unordered_map<std::string, ServiceInterfaceFactory> service_interface_factory;
|
std::unordered_map<std::string, ServiceInterfaceFactory> service_interface_factory;
|
||||||
NamedPortTable named_ports;
|
NamedPortTable named_ports;
|
||||||
std::unordered_set<KServerPort*> server_ports;
|
std::unordered_set<KServerPort*> server_ports;
|
||||||
std::unordered_set<KServerSession*> server_sessions;
|
|
||||||
std::unordered_set<KAutoObject*> registered_objects;
|
std::unordered_set<KAutoObject*> registered_objects;
|
||||||
std::unordered_set<KAutoObject*> registered_in_use_objects;
|
std::unordered_set<KAutoObject*> registered_in_use_objects;
|
||||||
|
|
||||||
@ -932,16 +920,6 @@ KClientPort* KernelCore::CreateNamedServicePort(std::string name) {
|
|||||||
return impl->CreateNamedServicePort(std::move(name));
|
return impl->CreateNamedServicePort(std::move(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
void KernelCore::RegisterServerSession(KServerSession* server_session) {
|
|
||||||
std::lock_guard lk(impl->server_sessions_lock);
|
|
||||||
impl->server_sessions.insert(server_session);
|
|
||||||
}
|
|
||||||
|
|
||||||
void KernelCore::UnregisterServerSession(KServerSession* server_session) {
|
|
||||||
std::lock_guard lk(impl->server_sessions_lock);
|
|
||||||
impl->server_sessions.erase(server_session);
|
|
||||||
}
|
|
||||||
|
|
||||||
void KernelCore::RegisterKernelObject(KAutoObject* object) {
|
void KernelCore::RegisterKernelObject(KAutoObject* object) {
|
||||||
std::lock_guard lk(impl->registered_objects_lock);
|
std::lock_guard lk(impl->registered_objects_lock);
|
||||||
impl->registered_objects.insert(object);
|
impl->registered_objects.insert(object);
|
||||||
|
@ -196,14 +196,6 @@ public:
|
|||||||
/// Opens a port to a service previously registered with RegisterNamedService.
|
/// Opens a port to a service previously registered with RegisterNamedService.
|
||||||
KClientPort* CreateNamedServicePort(std::string name);
|
KClientPort* CreateNamedServicePort(std::string name);
|
||||||
|
|
||||||
/// Registers a server session with the gobal emulation state, to be freed on shutdown. This is
|
|
||||||
/// necessary because we do not emulate processes for HLE sessions.
|
|
||||||
void RegisterServerSession(KServerSession* server_session);
|
|
||||||
|
|
||||||
/// Unregisters a server session previously registered with RegisterServerSession when it was
|
|
||||||
/// destroyed during the current emulation session.
|
|
||||||
void UnregisterServerSession(KServerSession* server_session);
|
|
||||||
|
|
||||||
/// Registers all kernel objects with the global emulation state, this is purely for tracking
|
/// Registers all kernel objects with the global emulation state, this is purely for tracking
|
||||||
/// leaks after emulation has been shutdown.
|
/// leaks after emulation has been shutdown.
|
||||||
void RegisterKernelObject(KAutoObject* object);
|
void RegisterKernelObject(KAutoObject* object);
|
||||||
|
Loading…
Reference in New Issue
Block a user