diff options
author | liamwhite <liamwhite@users.noreply.github.com> | 2023-03-13 14:16:16 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-13 14:16:16 +0100 |
commit | 1f952f6ac9e3aca3dba8e4286fe937616081a767 (patch) | |
tree | ca57513605bdef4767762614c074ca90b7791575 /src/core/hle/kernel/slab_helpers.h | |
parent | Merge pull request #9942 from liamwhite/speling (diff) | |
parent | kernel: additional style fixes to KThread, KProcess (diff) | |
download | yuzu-1f952f6ac9e3aca3dba8e4286fe937616081a767.tar yuzu-1f952f6ac9e3aca3dba8e4286fe937616081a767.tar.gz yuzu-1f952f6ac9e3aca3dba8e4286fe937616081a767.tar.bz2 yuzu-1f952f6ac9e3aca3dba8e4286fe937616081a767.tar.lz yuzu-1f952f6ac9e3aca3dba8e4286fe937616081a767.tar.xz yuzu-1f952f6ac9e3aca3dba8e4286fe937616081a767.tar.zst yuzu-1f952f6ac9e3aca3dba8e4286fe937616081a767.zip |
Diffstat (limited to 'src/core/hle/kernel/slab_helpers.h')
-rw-r--r-- | src/core/hle/kernel/slab_helpers.h | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/src/core/hle/kernel/slab_helpers.h b/src/core/hle/kernel/slab_helpers.h index 0228ce188..d1bbc7670 100644 --- a/src/core/hle/kernel/slab_helpers.h +++ b/src/core/hle/kernel/slab_helpers.h @@ -66,7 +66,7 @@ private: } public: - explicit KAutoObjectWithSlabHeap(KernelCore& kernel_) : Base(kernel_), kernel(kernel_) {} + explicit KAutoObjectWithSlabHeap(KernelCore& kernel) : Base(kernel) {} virtual ~KAutoObjectWithSlabHeap() = default; virtual void Destroy() override { @@ -76,7 +76,7 @@ public: arg = this->GetPostDestroyArgument(); this->Finalize(); } - Free(kernel, static_cast<Derived*>(this)); + Free(Base::m_kernel, static_cast<Derived*>(this)); if (is_initialized) { Derived::PostDestroy(arg); } @@ -90,7 +90,7 @@ public: } size_t GetSlabIndex() const { - return SlabHeap<Derived>(kernel).GetObjectIndex(static_cast<const Derived*>(this)); + return SlabHeap<Derived>(Base::m_kernel).GetObjectIndex(static_cast<const Derived*>(this)); } public: @@ -125,14 +125,11 @@ public: static size_t GetNumRemaining(KernelCore& kernel) { return kernel.SlabHeap<Derived>().GetNumRemaining(); } - -protected: - KernelCore& kernel; }; template <typename Derived, typename Base> class KAutoObjectWithSlabHeapAndContainer : public Base { - static_assert(std::is_base_of<KAutoObjectWithList, Base>::value); + static_assert(std::is_base_of_v<KAutoObjectWithList, Base>); private: static Derived* Allocate(KernelCore& kernel) { @@ -144,18 +141,18 @@ private: } public: - KAutoObjectWithSlabHeapAndContainer(KernelCore& kernel_) : Base(kernel_), kernel(kernel_) {} + KAutoObjectWithSlabHeapAndContainer(KernelCore& kernel) : Base(kernel) {} virtual ~KAutoObjectWithSlabHeapAndContainer() {} virtual void Destroy() override { const bool is_initialized = this->IsInitialized(); uintptr_t arg = 0; if (is_initialized) { - kernel.ObjectListContainer().Unregister(this); + Base::m_kernel.ObjectListContainer().Unregister(this); arg = this->GetPostDestroyArgument(); this->Finalize(); } - Free(kernel, static_cast<Derived*>(this)); + Free(Base::m_kernel, static_cast<Derived*>(this)); if (is_initialized) { Derived::PostDestroy(arg); } @@ -169,7 +166,7 @@ public: } size_t GetSlabIndex() const { - return SlabHeap<Derived>(kernel).GetObjectIndex(static_cast<const Derived*>(this)); + return SlabHeap<Derived>(Base::m_kernel).GetObjectIndex(static_cast<const Derived*>(this)); } public: @@ -209,9 +206,6 @@ public: static size_t GetNumRemaining(KernelCore& kernel) { return kernel.SlabHeap<Derived>().GetNumRemaining(); } - -protected: - KernelCore& kernel; }; } // namespace Kernel |