diff options
author | Andreas Kling <kling@serenityos.org> | 2022-08-19 17:26:07 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-08-20 17:15:52 +0200 |
commit | e475263113387404e63cdc3666391934604eb6e7 (patch) | |
tree | 5d15d4f41a7811f58171b6e8bdd6ae014e2bea7d /Kernel/Memory | |
parent | 4889eb019a47478e50e1876f9584356e957e4ea4 (diff) | |
download | serenity-e475263113387404e63cdc3666391934604eb6e7.zip |
AK+Kernel: Add AK::AtomicRefCounted and use everywhere in the kernel
Instead of having two separate implementations of AK::RefCounted, one
for userspace and one for kernelspace, there is now RefCounted and
AtomicRefCounted.
Diffstat (limited to 'Kernel/Memory')
-rw-r--r-- | Kernel/Memory/AnonymousVMObject.h | 2 | ||||
-rw-r--r-- | Kernel/Memory/PageDirectory.h | 4 | ||||
-rw-r--r-- | Kernel/Memory/ScatterGatherList.h | 3 |
3 files changed, 5 insertions, 4 deletions
diff --git a/Kernel/Memory/AnonymousVMObject.h b/Kernel/Memory/AnonymousVMObject.h index 5733235ce9..71f1ef0663 100644 --- a/Kernel/Memory/AnonymousVMObject.h +++ b/Kernel/Memory/AnonymousVMObject.h @@ -63,7 +63,7 @@ private: Bitmap m_cow_map; // AnonymousVMObject shares committed COW pages with cloned children (happens on fork) - class SharedCommittedCowPages : public RefCounted<SharedCommittedCowPages> { + class SharedCommittedCowPages final : public AtomicRefCounted<SharedCommittedCowPages> { AK_MAKE_NONCOPYABLE(SharedCommittedCowPages); public: diff --git a/Kernel/Memory/PageDirectory.h b/Kernel/Memory/PageDirectory.h index 842519dd0f..84450e665b 100644 --- a/Kernel/Memory/PageDirectory.h +++ b/Kernel/Memory/PageDirectory.h @@ -6,10 +6,10 @@ #pragma once +#include <AK/AtomicRefCounted.h> #include <AK/Badge.h> #include <AK/HashMap.h> #include <AK/IntrusiveRedBlackTree.h> -#include <AK/RefCounted.h> #include <AK/RefPtr.h> #include <Kernel/Forward.h> #include <Kernel/Locking/Spinlock.h> @@ -17,7 +17,7 @@ namespace Kernel::Memory { -class PageDirectory : public RefCounted<PageDirectory> { +class PageDirectory final : public AtomicRefCounted<PageDirectory> { friend class MemoryManager; public: diff --git a/Kernel/Memory/ScatterGatherList.h b/Kernel/Memory/ScatterGatherList.h index 6fedb75cad..1c57b6a2eb 100644 --- a/Kernel/Memory/ScatterGatherList.h +++ b/Kernel/Memory/ScatterGatherList.h @@ -6,6 +6,7 @@ #pragma once +#include <AK/AtomicRefCounted.h> #include <AK/Vector.h> #include <Kernel/Devices/BlockDevice.h> #include <Kernel/Memory/AnonymousVMObject.h> @@ -16,7 +17,7 @@ namespace Kernel::Memory { // A Scatter-Gather List type that owns its buffers -class ScatterGatherList : public RefCounted<ScatterGatherList> { +class ScatterGatherList final : public AtomicRefCounted<ScatterGatherList> { public: static RefPtr<ScatterGatherList> try_create(AsyncBlockDeviceRequest&, Span<NonnullRefPtr<PhysicalPage>> allocated_pages, size_t device_block_size); VMObject const& vmobject() const { return m_vm_object; } |