mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2025-07-20 18:45:45 +00:00
hle: kernel: Migrate KPort, KClientPort, and KServerPort to KAutoObject.
This commit is contained in:
parent
2bc45b4a13
commit
d6844cf75f
22 changed files with 447 additions and 169 deletions
|
@ -1,8 +1,9 @@
|
|||
// Copyright 2019 yuzu emulator team
|
||||
// Copyright 2021 yuzu emulator team
|
||||
// Licensed under GPLv2 or any later version
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include "common/assert.h"
|
||||
#include "core/hle/kernel/k_client_port.h"
|
||||
#include "core/hle/kernel/k_client_session.h"
|
||||
#include "core/hle/kernel/k_scoped_resource_reservation.h"
|
||||
#include "core/hle/kernel/k_server_session.h"
|
||||
|
@ -14,7 +15,7 @@ KSession::KSession(KernelCore& kernel)
|
|||
: KAutoObjectWithSlabHeapAndContainer{kernel}, server{kernel}, client{kernel} {}
|
||||
KSession::~KSession() = default;
|
||||
|
||||
void KSession::Initialize(std::string&& name_) {
|
||||
void KSession::Initialize(KClientPort* port_, std::string&& name_) {
|
||||
// Increment reference count.
|
||||
// Because reference count is one on creation, this will result
|
||||
// in a reference count of two. Thus, when both server and client are closed
|
||||
|
@ -37,11 +38,22 @@ void KSession::Initialize(std::string&& name_) {
|
|||
process = kernel.CurrentProcess();
|
||||
process->Open();
|
||||
|
||||
// Set our port.
|
||||
port = port_;
|
||||
if (port != nullptr) {
|
||||
port->Open();
|
||||
}
|
||||
|
||||
// Mark initialized.
|
||||
initialized = true;
|
||||
}
|
||||
|
||||
void KSession::Finalize() {}
|
||||
void KSession::Finalize() {
|
||||
if (port != nullptr) {
|
||||
port->OnSessionFinalized();
|
||||
port->Close();
|
||||
}
|
||||
}
|
||||
|
||||
void KSession::OnServerClosed() {
|
||||
if (GetState() == State::Normal) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue