mirror of
https://github.com/yuzu-emu/yuzu-android.git
synced 2025-06-14 13:07:56 -05:00
hle: kernel: Migrate KPort, KClientPort, and KServerPort to KAutoObject.
This commit is contained in:
@ -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) {
|
||||
|
Reference in New Issue
Block a user