core: hle: kernel: object: Implement Finalize() virtual method.
This commit is contained in:
parent
33b4930280
commit
ff186b2498
15 changed files with 29 additions and 6 deletions
|
@ -51,6 +51,8 @@ public:
|
||||||
*/
|
*/
|
||||||
void ConnectionClosed();
|
void ConnectionClosed();
|
||||||
|
|
||||||
|
void Finalize() override {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::shared_ptr<ServerPort> server_port; ///< ServerPort associated with this client port.
|
std::shared_ptr<ServerPort> server_port; ///< ServerPort associated with this client port.
|
||||||
u32 max_sessions = 0; ///< Maximum number of simultaneous sessions the port can have
|
u32 max_sessions = 0; ///< Maximum number of simultaneous sessions the port can have
|
||||||
|
|
|
@ -51,6 +51,8 @@ public:
|
||||||
|
|
||||||
bool IsSignaled() const override;
|
bool IsSignaled() const override;
|
||||||
|
|
||||||
|
void Finalize() override {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static ResultVal<std::shared_ptr<ClientSession>> Create(KernelCore& kernel,
|
static ResultVal<std::shared_ptr<ClientSession>> Create(KernelCore& kernel,
|
||||||
std::shared_ptr<Session> parent,
|
std::shared_ptr<Session> parent,
|
||||||
|
|
|
@ -89,6 +89,10 @@ ResultCode HandleTable::Close(Handle handle) {
|
||||||
|
|
||||||
const u16 slot = GetSlot(handle);
|
const u16 slot = GetSlot(handle);
|
||||||
|
|
||||||
|
if (objects[slot].use_count() == 1) {
|
||||||
|
objects[slot]->Finalize();
|
||||||
|
}
|
||||||
|
|
||||||
objects[slot] = nullptr;
|
objects[slot] = nullptr;
|
||||||
|
|
||||||
generations[slot] = next_free_slot;
|
generations[slot] = next_free_slot;
|
||||||
|
|
|
@ -136,7 +136,7 @@ ResultCode KSynchronizationObject::Wait(KernelCore& kernel, s32* out_index,
|
||||||
|
|
||||||
KSynchronizationObject::KSynchronizationObject(KernelCore& kernel) : Object{kernel} {}
|
KSynchronizationObject::KSynchronizationObject(KernelCore& kernel) : Object{kernel} {}
|
||||||
|
|
||||||
KSynchronizationObject ::~KSynchronizationObject() = default;
|
KSynchronizationObject::~KSynchronizationObject() = default;
|
||||||
|
|
||||||
void KSynchronizationObject::NotifyAvailable(ResultCode result) {
|
void KSynchronizationObject::NotifyAvailable(ResultCode result) {
|
||||||
KScopedSchedulerLock lock(kernel);
|
KScopedSchedulerLock lock(kernel);
|
||||||
|
|
|
@ -61,6 +61,8 @@ public:
|
||||||
*/
|
*/
|
||||||
bool IsWaitable() const;
|
bool IsWaitable() const;
|
||||||
|
|
||||||
|
virtual void Finalize() = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/// The kernel instance this object was created under.
|
/// The kernel instance this object was created under.
|
||||||
KernelCore& kernel;
|
KernelCore& kernel;
|
||||||
|
|
|
@ -308,6 +308,8 @@ public:
|
||||||
|
|
||||||
bool IsSignaled() const override;
|
bool IsSignaled() const override;
|
||||||
|
|
||||||
|
void Finalize() override {}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// Thread-local storage management
|
// Thread-local storage management
|
||||||
|
|
||||||
|
|
|
@ -47,6 +47,8 @@ public:
|
||||||
|
|
||||||
bool IsSignaled() const override;
|
bool IsSignaled() const override;
|
||||||
|
|
||||||
|
void Finalize() override {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
explicit ReadableEvent(KernelCore& kernel);
|
explicit ReadableEvent(KernelCore& kernel);
|
||||||
|
|
||||||
|
|
|
@ -85,6 +85,8 @@ public:
|
||||||
*/
|
*/
|
||||||
ResultCode SetLimitValue(ResourceType resource, s64 value);
|
ResultCode SetLimitValue(ResourceType resource, s64 value);
|
||||||
|
|
||||||
|
void Finalize() override {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// TODO(Subv): Increment resource limit current values in their respective Kernel::T::Create
|
// TODO(Subv): Increment resource limit current values in their respective Kernel::T::Create
|
||||||
// functions
|
// functions
|
||||||
|
|
|
@ -81,6 +81,8 @@ public:
|
||||||
|
|
||||||
bool IsSignaled() const override;
|
bool IsSignaled() const override;
|
||||||
|
|
||||||
|
void Finalize() override {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// ServerSessions waiting to be accepted by the port
|
/// ServerSessions waiting to be accepted by the port
|
||||||
std::vector<std::shared_ptr<ServerSession>> pending_sessions;
|
std::vector<std::shared_ptr<ServerSession>> pending_sessions;
|
||||||
|
|
|
@ -126,6 +126,8 @@ public:
|
||||||
|
|
||||||
bool IsSignaled() const override;
|
bool IsSignaled() const override;
|
||||||
|
|
||||||
|
void Finalize() override {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// Queues a sync request from the emulated application.
|
/// Queues a sync request from the emulated application.
|
||||||
ResultCode QueueSyncRequest(std::shared_ptr<KThread> thread, Core::Memory::Memory& memory);
|
ResultCode QueueSyncRequest(std::shared_ptr<KThread> thread, Core::Memory::Memory& memory);
|
||||||
|
|
|
@ -39,6 +39,8 @@ public:
|
||||||
|
|
||||||
bool IsSignaled() const override;
|
bool IsSignaled() const override;
|
||||||
|
|
||||||
|
void Finalize() override {}
|
||||||
|
|
||||||
std::shared_ptr<ClientSession> Client() {
|
std::shared_ptr<ClientSession> Client() {
|
||||||
if (auto result{client.lock()}) {
|
if (auto result{client.lock()}) {
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -71,6 +71,8 @@ public:
|
||||||
return device_memory.GetPointer(physical_address + offset);
|
return device_memory.GetPointer(physical_address + offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Finalize() override {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Core::DeviceMemory& device_memory;
|
Core::DeviceMemory& device_memory;
|
||||||
Process* owner_process{};
|
Process* owner_process{};
|
||||||
|
|
|
@ -72,6 +72,8 @@ public:
|
||||||
/// is closed.
|
/// is closed.
|
||||||
ResultCode Reset();
|
ResultCode Reset();
|
||||||
|
|
||||||
|
void Finalize() override {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// The base address for the memory managed by this instance.
|
/// The base address for the memory managed by this instance.
|
||||||
VAddr base_address{};
|
VAddr base_address{};
|
||||||
|
|
|
@ -38,8 +38,4 @@ void WritableEvent::Clear() {
|
||||||
readable->Clear();
|
readable->Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WritableEvent::IsSignaled() const {
|
|
||||||
return readable->IsSignaled();
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Kernel
|
} // namespace Kernel
|
||||||
|
|
|
@ -46,7 +46,8 @@ public:
|
||||||
|
|
||||||
void Signal();
|
void Signal();
|
||||||
void Clear();
|
void Clear();
|
||||||
bool IsSignaled() const;
|
|
||||||
|
void Finalize() override {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
explicit WritableEvent(KernelCore& kernel);
|
explicit WritableEvent(KernelCore& kernel);
|
||||||
|
|
Loading…
Reference in a new issue