diff options
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 |