diff options
45 files changed, 118 insertions, 118 deletions
diff --git a/AK/ByteBuffer.h b/AK/ByteBuffer.h index 1f866ed5e5..ffd39b834a 100644 --- a/AK/ByteBuffer.h +++ b/AK/ByteBuffer.h @@ -8,7 +8,7 @@ namespace AK { -class ByteBufferImpl : public Retainable<ByteBufferImpl> { +class ByteBufferImpl : public RefCounted<ByteBufferImpl> { public: static Retained<ByteBufferImpl> create_uninitialized(int size); static Retained<ByteBufferImpl> create_zeroed(int); diff --git a/AK/JsonValue.cpp b/AK/JsonValue.cpp index 4c8b22a14b..55f58f7a32 100644 --- a/AK/JsonValue.cpp +++ b/AK/JsonValue.cpp @@ -30,7 +30,7 @@ void JsonValue::copy_from(const JsonValue& other) switch (m_type) { case Type::String: m_value.as_string = other.m_value.as_string; - AK::retain_if_not_null(m_value.as_string); + AK::ref_if_not_null(m_value.as_string); break; case Type::Object: m_value.as_object = new JsonObject(*other.m_value.as_object); @@ -101,7 +101,7 @@ JsonValue::JsonValue(const String& value) } else { m_type = Type::String; m_value.as_string = const_cast<StringImpl*>(value.impl()); - AK::retain_if_not_null(m_value.as_string); + AK::ref_if_not_null(m_value.as_string); } } @@ -121,7 +121,7 @@ void JsonValue::clear() { switch (m_type) { case Type::String: - AK::release_if_not_null(m_value.as_string); + AK::deref_if_not_null(m_value.as_string); break; case Type::Object: delete m_value.as_object; diff --git a/AK/RetainPtr.h b/AK/RetainPtr.h index f22b0d0f73..b11870d8fa 100644 --- a/AK/RetainPtr.h +++ b/AK/RetainPtr.h @@ -16,22 +16,22 @@ public: RetainPtr(const T* ptr) : m_ptr(const_cast<T*>(ptr)) { - retain_if_not_null(m_ptr); + ref_if_not_null(m_ptr); } RetainPtr(T* ptr) : m_ptr(ptr) { - retain_if_not_null(m_ptr); + ref_if_not_null(m_ptr); } RetainPtr(T& object) : m_ptr(&object) { - m_ptr->retain(); + m_ptr->ref(); } RetainPtr(const T& object) : m_ptr(const_cast<T*>(&object)) { - m_ptr->retain(); + m_ptr->ref(); } RetainPtr(AdoptTag, T& object) : m_ptr(&object) @@ -79,7 +79,7 @@ public: RetainPtr& operator=(RetainPtr&& other) { if (this != &other) { - release_if_not_null(m_ptr); + deref_if_not_null(m_ptr); m_ptr = other.leak_ref(); } return *this; @@ -89,7 +89,7 @@ public: RetainPtr& operator=(RetainPtr<U>&& other) { if (this != static_cast<void*>(&other)) { - release_if_not_null(m_ptr); + deref_if_not_null(m_ptr); m_ptr = other.leak_ref(); } return *this; @@ -98,7 +98,7 @@ public: template<typename U> RetainPtr& operator=(Retained<U>&& other) { - release_if_not_null(m_ptr); + deref_if_not_null(m_ptr); m_ptr = &other.leak_ref(); return *this; } @@ -107,10 +107,10 @@ public: RetainPtr& operator=(const Retained<U>& other) { if (m_ptr != other.ptr()) - release_if_not_null(m_ptr); + deref_if_not_null(m_ptr); m_ptr = const_cast<T*>(other.ptr()); ASSERT(m_ptr); - retain_if_not_null(m_ptr); + ref_if_not_null(m_ptr); return *this; } @@ -118,27 +118,27 @@ public: RetainPtr& operator=(const RetainPtr<U>& other) { if (m_ptr != other.ptr()) - release_if_not_null(m_ptr); + deref_if_not_null(m_ptr); m_ptr = const_cast<T*>(other.ptr()); - retain_if_not_null(m_ptr); + ref_if_not_null(m_ptr); return *this; } RetainPtr& operator=(const T* ptr) { if (m_ptr != ptr) - release_if_not_null(m_ptr); + deref_if_not_null(m_ptr); m_ptr = const_cast<T*>(ptr); - retain_if_not_null(m_ptr); + ref_if_not_null(m_ptr); return *this; } RetainPtr& operator=(const T& object) { if (m_ptr != &object) - release_if_not_null(m_ptr); + deref_if_not_null(m_ptr); m_ptr = const_cast<T*>(&object); - retain_if_not_null(m_ptr); + ref_if_not_null(m_ptr); return *this; } @@ -155,7 +155,7 @@ public: void clear() { - release_if_not_null(m_ptr); + deref_if_not_null(m_ptr); m_ptr = nullptr; } diff --git a/AK/Retainable.h b/AK/Retainable.h index be928f8521..cc6b67737a 100644 --- a/AK/Retainable.h +++ b/AK/Retainable.h @@ -18,61 +18,61 @@ constexpr auto call_will_be_destroyed_if_present(...) -> FalseType } template<class T> -constexpr auto call_one_retain_left_if_present(T* object) -> decltype(object->one_retain_left(), TrueType {}) +constexpr auto call_one_ref_left_if_present(T* object) -> decltype(object->one_ref_left(), TrueType {}) { - object->one_retain_left(); + object->one_ref_left(); return {}; } -constexpr auto call_one_retain_left_if_present(...) -> FalseType +constexpr auto call_one_ref_left_if_present(...) -> FalseType { return {}; } -class RetainableBase { +class RefCountedBase { public: - void retain() + void ref() { - ASSERT(m_retain_count); - ++m_retain_count; + ASSERT(m_ref_count); + ++m_ref_count; } - int retain_count() const + int ref_count() const { - return m_retain_count; + return m_ref_count; } protected: - RetainableBase() {} - ~RetainableBase() + RefCountedBase() {} + ~RefCountedBase() { - ASSERT(!m_retain_count); + ASSERT(!m_ref_count); } - void release_base() + void deref_base() { - ASSERT(m_retain_count); - --m_retain_count; + ASSERT(m_ref_count); + --m_ref_count; } - int m_retain_count { 1 }; + int m_ref_count { 1 }; }; template<typename T> -class Retainable : public RetainableBase { +class RefCounted : public RefCountedBase { public: - void release() + void deref() { - release_base(); - if (m_retain_count == 0) { + deref_base(); + if (m_ref_count == 0) { call_will_be_destroyed_if_present(static_cast<T*>(this)); delete static_cast<T*>(this); - } else if (m_retain_count == 1) { - call_one_retain_left_if_present(static_cast<T*>(this)); + } else if (m_ref_count == 1) { + call_one_ref_left_if_present(static_cast<T*>(this)); } } }; } -using AK::Retainable; +using AK::RefCounted; diff --git a/AK/Retained.h b/AK/Retained.h index a7938e0174..ba86036a27 100644 --- a/AK/Retained.h +++ b/AK/Retained.h @@ -18,17 +18,17 @@ namespace AK { template<typename T> -inline void retain_if_not_null(T* ptr) +inline void ref_if_not_null(T* ptr) { if (ptr) - ptr->retain(); + ptr->ref(); } template<typename T> -inline void release_if_not_null(T* ptr) +inline void deref_if_not_null(T* ptr) { if (ptr) - ptr->release(); + ptr->deref(); } template<typename T> @@ -42,14 +42,14 @@ public: Retained(const T& object) : m_ptr(const_cast<T*>(&object)) { - m_ptr->retain(); + m_ptr->ref(); } template<typename U> RETURN_TYPESTATE(unconsumed) Retained(const U& object) : m_ptr(&const_cast<T&>(static_cast<const T&>(object))) { - m_ptr->retain(); + m_ptr->ref(); } RETURN_TYPESTATE(unconsumed) Retained(AdoptTag, T& object) @@ -85,7 +85,7 @@ public: } ~Retained() { - release_if_not_null(m_ptr); + deref_if_not_null(m_ptr); m_ptr = nullptr; #ifdef SANITIZE_PTRS if constexpr (sizeof(T*) == 8) @@ -99,7 +99,7 @@ public: Retained& operator=(Retained&& other) { if (this != &other) { - release_if_not_null(m_ptr); + deref_if_not_null(m_ptr); m_ptr = &other.leak_ref(); } return *this; @@ -110,7 +110,7 @@ public: Retained& operator=(Retained<U>&& other) { if (this != static_cast<void*>(&other)) { - release_if_not_null(m_ptr); + deref_if_not_null(m_ptr); m_ptr = &other.leak_ref(); } return *this; @@ -120,9 +120,9 @@ public: Retained& operator=(T& object) { if (m_ptr != &object) - release_if_not_null(m_ptr); + deref_if_not_null(m_ptr); m_ptr = &object; - m_ptr->retain(); + m_ptr->ref(); return *this; } diff --git a/AK/StringImpl.h b/AK/StringImpl.h index 19d09331ac..5eb0a27962 100644 --- a/AK/StringImpl.h +++ b/AK/StringImpl.h @@ -12,7 +12,7 @@ enum ShouldChomp { Chomp }; -class StringImpl : public Retainable<StringImpl> { +class StringImpl : public RefCounted<StringImpl> { public: static Retained<StringImpl> create_uninitialized(int length, char*& buffer); static RetainPtr<StringImpl> create(const char* cstring, ShouldChomp = NoChomp); diff --git a/AK/Weakable.h b/AK/Weakable.h index d5b55050d3..ba9a428ffb 100644 --- a/AK/Weakable.h +++ b/AK/Weakable.h @@ -12,7 +12,7 @@ template<typename T> class WeakPtr; template<typename T> -class WeakLink : public Retainable<WeakLink<T>> { +class WeakLink : public RefCounted<WeakLink<T>> { friend class Weakable<T>; public: diff --git a/Applications/IRCClient/IRCChannel.h b/Applications/IRCClient/IRCChannel.h index de9132639a..fe219c2534 100644 --- a/Applications/IRCClient/IRCChannel.h +++ b/Applications/IRCClient/IRCChannel.h @@ -11,7 +11,7 @@ class IRCClient; class IRCChannelMemberListModel; class IRCWindow; -class IRCChannel : public Retainable<IRCChannel> { +class IRCChannel : public RefCounted<IRCChannel> { public: static Retained<IRCChannel> create(IRCClient&, const String&); ~IRCChannel(); diff --git a/Applications/IRCClient/IRCLogBuffer.h b/Applications/IRCClient/IRCLogBuffer.h index 7d2bdff220..0720b5b32d 100644 --- a/Applications/IRCClient/IRCLogBuffer.h +++ b/Applications/IRCClient/IRCLogBuffer.h @@ -8,7 +8,7 @@ class IRCLogBufferModel; -class IRCLogBuffer : public Retainable<IRCLogBuffer> { +class IRCLogBuffer : public RefCounted<IRCLogBuffer> { public: static Retained<IRCLogBuffer> create(); ~IRCLogBuffer(); diff --git a/Applications/IRCClient/IRCQuery.h b/Applications/IRCClient/IRCQuery.h index 88f941fbdf..e7e52a1a8e 100644 --- a/Applications/IRCClient/IRCQuery.h +++ b/Applications/IRCClient/IRCQuery.h @@ -10,7 +10,7 @@ class IRCClient; class IRCWindow; -class IRCQuery : public Retainable<IRCQuery> { +class IRCQuery : public RefCounted<IRCQuery> { public: static Retained<IRCQuery> create(IRCClient&, const String& name); ~IRCQuery(); diff --git a/DevTools/VisualBuilder/VBWidget.h b/DevTools/VisualBuilder/VBWidget.h index 8717e519d3..e71e82efa8 100644 --- a/DevTools/VisualBuilder/VBWidget.h +++ b/DevTools/VisualBuilder/VBWidget.h @@ -39,7 +39,7 @@ inline void for_each_direction(Callback callback) callback(Direction::DownLeft); } -class VBWidget : public Retainable<VBWidget> +class VBWidget : public RefCounted<VBWidget> , public Weakable<VBWidget> { friend class VBWidgetPropertyModel; diff --git a/Kernel/Devices/DiskDevice.h b/Kernel/Devices/DiskDevice.h index 66a51a8f41..a8b7246e84 100644 --- a/Kernel/Devices/DiskDevice.h +++ b/Kernel/Devices/DiskDevice.h @@ -6,7 +6,7 @@ // FIXME: Support 64-bit DiskOffset typedef dword DiskOffset; -class DiskDevice : public Retainable<DiskDevice> { +class DiskDevice : public RefCounted<DiskDevice> { public: virtual ~DiskDevice(); diff --git a/Kernel/File.h b/Kernel/File.h index 03fb9d4aef..ec81adbdf4 100644 --- a/Kernel/File.h +++ b/Kernel/File.h @@ -39,7 +39,7 @@ class Region; // - Called by mmap() when userspace wants to memory-map this File somewhere. // - Should create a Region in the Process and return it if successful. -class File : public Retainable<File> { +class File : public RefCounted<File> { public: virtual ~File(); diff --git a/Kernel/FileSystem/Custody.h b/Kernel/FileSystem/Custody.h index 9de3d93dd8..03c6fabdff 100644 --- a/Kernel/FileSystem/Custody.h +++ b/Kernel/FileSystem/Custody.h @@ -10,7 +10,7 @@ class VFS; // FIXME: Custody needs some locking. -class Custody : public Retainable<Custody> { +class Custody : public RefCounted<Custody> { public: static Custody* get_if_cached(Custody* parent, const String& name); static Retained<Custody> get_or_create(Custody* parent, const String& name, Inode&); diff --git a/Kernel/FileSystem/Ext2FileSystem.cpp b/Kernel/FileSystem/Ext2FileSystem.cpp index 3ad2c9b306..c9ea7b06bc 100644 --- a/Kernel/FileSystem/Ext2FileSystem.cpp +++ b/Kernel/FileSystem/Ext2FileSystem.cpp @@ -1232,7 +1232,7 @@ InodeIdentifier Ext2FSInode::lookup(StringView name) return {}; } -void Ext2FSInode::one_retain_left() +void Ext2FSInode::one_ref_left() { // FIXME: I would like to not live forever, but uncached Ext2FS is fucking painful right now. } diff --git a/Kernel/FileSystem/Ext2FileSystem.h b/Kernel/FileSystem/Ext2FileSystem.h index ead3e9ec62..7ef3d10240 100644 --- a/Kernel/FileSystem/Ext2FileSystem.h +++ b/Kernel/FileSystem/Ext2FileSystem.h @@ -21,7 +21,7 @@ public: bool is_symlink() const { return ::is_symlink(m_raw_inode.i_mode); } // ^Inode (Retainable magic) - virtual void one_retain_left() override; + virtual void one_ref_left() override; private: // ^Inode diff --git a/Kernel/FileSystem/FileDescription.h b/Kernel/FileSystem/FileDescription.h index 4c8e0175e7..2cffc5169a 100644 --- a/Kernel/FileSystem/FileDescription.h +++ b/Kernel/FileSystem/FileDescription.h @@ -19,7 +19,7 @@ class Region; class CharacterDevice; class SharedMemory; -class FileDescription : public Retainable<FileDescription> { +class FileDescription : public RefCounted<FileDescription> { public: static Retained<FileDescription> create(RetainPtr<Custody>&&); static Retained<FileDescription> create(RetainPtr<File>&&, SocketRole = SocketRole::None); diff --git a/Kernel/FileSystem/FileSystem.h b/Kernel/FileSystem/FileSystem.h index a41063c0a8..3e9fcc6314 100644 --- a/Kernel/FileSystem/FileSystem.h +++ b/Kernel/FileSystem/FileSystem.h @@ -23,7 +23,7 @@ class FileDescription; class LocalSocket; class VMObject; -class FS : public Retainable<FS> { +class FS : public RefCounted<FS> { friend class Inode; public: diff --git a/Kernel/FileSystem/Inode.h b/Kernel/FileSystem/Inode.h index b2c56a5a20..c7d3baf274 100644 --- a/Kernel/FileSystem/Inode.h +++ b/Kernel/FileSystem/Inode.h @@ -14,14 +14,14 @@ class FileDescription; class LocalSocket; class VMObject; -class Inode : public Retainable<Inode> { +class Inode : public RefCounted<Inode> { friend class VFS; friend class FS; public: virtual ~Inode(); - virtual void one_retain_left() {} + virtual void one_ref_left() {} FS& fs() { return m_fs; } const FS& fs() const { return m_fs; } diff --git a/Kernel/FileSystem/ProcFS.cpp b/Kernel/FileSystem/ProcFS.cpp index cbcb422dda..95ad22096b 100644 --- a/Kernel/FileSystem/ProcFS.cpp +++ b/Kernel/FileSystem/ProcFS.cpp @@ -293,13 +293,13 @@ ByteBuffer procfs$pid_vmo(InodeIdentifier identifier) region->vmo().is_anonymous() ? "anonymous" : "file-backed", region->vmo().name().characters(), ®ion->vmo(), - region->vmo().retain_count()); + region->vmo().ref_count()); for (size_t i = 0; i < region->vmo().page_count(); ++i) { auto& physical_page = region->vmo().physical_pages()[i]; builder.appendf("P%x%s(%u) ", physical_page ? physical_page->paddr().get() : 0, region->should_cow(i) ? "!" : "", - physical_page ? physical_page->retain_count() : 0); + physical_page ? physical_page->ref_count() : 0); } builder.appendf("\n"); } @@ -406,7 +406,7 @@ ByteBuffer procfs$mm(InodeIdentifier) builder.appendf("VMO: %p %s(%u): p:%4u %s\n", vmo, vmo->is_anonymous() ? "anon" : "file", - vmo->retain_count(), + vmo->ref_count(), vmo->page_count(), vmo->name().characters()); } @@ -615,7 +615,7 @@ ByteBuffer procfs$inodes(InodeIdentifier) StringBuilder builder; for (auto it : all_inodes()) { RetainPtr<Inode> inode = *it; - builder.appendf("Inode{K%x} %02u:%08u (%u)\n", inode.ptr(), inode->fsid(), inode->index(), inode->retain_count()); + builder.appendf("Inode{K%x} %02u:%08u (%u)\n", inode.ptr(), inode->fsid(), inode->index(), inode->ref_count()); } return builder.to_byte_buffer(); } diff --git a/Kernel/Process.cpp b/Kernel/Process.cpp index 7af8e97426..d671d177df 100644 --- a/Kernel/Process.cpp +++ b/Kernel/Process.cpp @@ -2032,7 +2032,7 @@ size_t Process::amount_shared() const { // FIXME: This will double count if multiple regions use the same physical page. // FIXME: It doesn't work at the moment, since it relies on PhysicalPage retain counts, - // and each PhysicalPage is only retained by its VMObject. This needs to be refactored + // and each PhysicalPage is only reffed by its VMObject. This needs to be refactored // so that every Region contributes +1 retain to each of its PhysicalPages. size_t amount = 0; for (auto& region : m_regions) { @@ -2417,8 +2417,8 @@ struct SharedBuffer { pid_t pid1() const { return m_pid1; } pid_t pid2() const { return m_pid2; } - unsigned pid1_retain_count() const { return m_pid1_retain_count; } - unsigned pid2_retain_count() const { return m_pid2_retain_count; } + unsigned pid1_ref_count() const { return m_pid1_retain_count; } + unsigned pid2_ref_count() const { return m_pid2_retain_count; } size_t size() const { return m_vmo->size(); } void destroy_if_unused(); diff --git a/Kernel/TTY/MasterPTY.cpp b/Kernel/TTY/MasterPTY.cpp index b3e64ceda1..62502c2390 100644 --- a/Kernel/TTY/MasterPTY.cpp +++ b/Kernel/TTY/MasterPTY.cpp @@ -61,11 +61,11 @@ bool MasterPTY::can_write(FileDescription&) const void MasterPTY::notify_slave_closed(Badge<SlavePTY>) { #ifdef MASTERPTY_DEBUG - dbgprintf("MasterPTY(%u): slave closed, my retains: %u, slave retains: %u\n", m_index, retain_count(), m_slave->retain_count()); + dbgprintf("MasterPTY(%u): slave closed, my retains: %u, slave retains: %u\n", m_index, ref_count(), m_slave->ref_count()); #endif // +1 retain for my MasterPTY::m_slave // +1 retain for FileDescription::m_device - if (m_slave->retain_count() == 2) + if (m_slave->ref_count() == 2) m_slave = nullptr; } @@ -86,7 +86,7 @@ bool MasterPTY::can_write_from_slave() const void MasterPTY::close() { - if (retain_count() == 2) { + if (ref_count() == 2) { InterruptDisabler disabler; // After the closing FileDescription dies, slave is the only thing keeping me alive. // From this point, let's consider ourselves closed. diff --git a/Kernel/VM/MemoryManager.cpp b/Kernel/VM/MemoryManager.cpp index d45fcda41f..bcc97d1b35 100644 --- a/Kernel/VM/MemoryManager.cpp +++ b/Kernel/VM/MemoryManager.cpp @@ -324,7 +324,7 @@ bool MemoryManager::copy_on_write(Region& region, unsigned page_index_in_region) { ASSERT_INTERRUPTS_DISABLED(); auto& vmo = region.vmo(); - if (vmo.physical_pages()[page_index_in_region]->retain_count() == 1) { + if (vmo.physical_pages()[page_index_in_region]->ref_count() == 1) { #ifdef PAGE_FAULT_DEBUG dbgprintf(" >> It's a COW page but nobody is sharing it anymore. Remap r/w\n"); #endif diff --git a/Kernel/VM/PageDirectory.h b/Kernel/VM/PageDirectory.h index b4f7ee876e..cf0876e438 100644 --- a/Kernel/VM/PageDirectory.h +++ b/Kernel/VM/PageDirectory.h @@ -6,7 +6,7 @@ #include <Kernel/VM/PhysicalPage.h> #include <Kernel/VM/RangeAllocator.h> -class PageDirectory : public Retainable<PageDirectory> { +class PageDirectory : public RefCounted<PageDirectory> { friend class MemoryManager; public: diff --git a/Kernel/VM/PhysicalPage.h b/Kernel/VM/PhysicalPage.h index 7d5c8c9426..e4422d14a0 100644 --- a/Kernel/VM/PhysicalPage.h +++ b/Kernel/VM/PhysicalPage.h @@ -12,13 +12,13 @@ class PhysicalPage { public: PhysicalAddress paddr() const { return m_paddr; } - void retain() + void ref() { ASSERT(m_retain_count); ++m_retain_count; } - void release() + void deref() { ASSERT(m_retain_count); if (!--m_retain_count) { @@ -30,7 +30,7 @@ public: static Retained<PhysicalPage> create(PhysicalAddress, bool supervisor, bool may_return_to_freelist = true); - word retain_count() const { return m_retain_count; } + word ref_count() const { return m_retain_count; } private: PhysicalPage(PhysicalAddress paddr, bool supervisor, bool may_return_to_freelist = true); diff --git a/Kernel/VM/PhysicalRegion.h b/Kernel/VM/PhysicalRegion.h index b14b6daf1a..7cecc4b365 100644 --- a/Kernel/VM/PhysicalRegion.h +++ b/Kernel/VM/PhysicalRegion.h @@ -6,7 +6,7 @@ #include <Kernel/PhysicalAddress.h> #include <Kernel/VM/PhysicalPage.h> -class PhysicalRegion : public Retainable<PhysicalRegion> { +class PhysicalRegion : public RefCounted<PhysicalRegion> { AK_MAKE_ETERNAL public: diff --git a/Kernel/VM/Region.cpp b/Kernel/VM/Region.cpp index d3cfd0c655..234fc4710b 100644 --- a/Kernel/VM/Region.cpp +++ b/Kernel/VM/Region.cpp @@ -129,7 +129,7 @@ size_t Region::amount_shared() const size_t bytes = 0; for (size_t i = 0; i < page_count(); ++i) { auto& physical_page = m_vmo->physical_pages()[first_page_index() + i]; - if (physical_page && physical_page->retain_count() > 1) + if (physical_page && physical_page->ref_count() > 1) bytes += PAGE_SIZE; } return bytes; diff --git a/Kernel/VM/Region.h b/Kernel/VM/Region.h index ef094bc0b6..1e0d374b17 100644 --- a/Kernel/VM/Region.h +++ b/Kernel/VM/Region.h @@ -8,7 +8,7 @@ class Inode; class VMObject; -class Region : public Retainable<Region> { +class Region : public RefCounted<Region> { friend class MemoryManager; public: diff --git a/Kernel/VM/VMObject.h b/Kernel/VM/VMObject.h index 6d69ac06ec..5713d54395 100644 --- a/Kernel/VM/VMObject.h +++ b/Kernel/VM/VMObject.h @@ -13,7 +13,7 @@ class Inode; class PhysicalPage; -class VMObject : public Retainable<VMObject> +class VMObject : public RefCounted<VMObject> , public Weakable<VMObject> { friend class MemoryManager; diff --git a/LibC/SharedBuffer.h b/LibC/SharedBuffer.h index 24fd371516..09c5b83f3a 100644 --- a/LibC/SharedBuffer.h +++ b/LibC/SharedBuffer.h @@ -3,7 +3,7 @@ #include <AK/RetainPtr.h> #include <AK/Retainable.h> -class SharedBuffer : public Retainable<SharedBuffer> { +class SharedBuffer : public RefCounted<SharedBuffer> { public: static RetainPtr<SharedBuffer> create(pid_t peer, int); static RetainPtr<SharedBuffer> create_from_shared_buffer_id(int); diff --git a/LibCore/CConfigFile.h b/LibCore/CConfigFile.h index 0f58b2b2a2..f771702776 100644 --- a/LibCore/CConfigFile.h +++ b/LibCore/CConfigFile.h @@ -7,7 +7,7 @@ #include <AK/Vector.h> #include <SharedGraphics/Color.h> -class CConfigFile : public Retainable<CConfigFile> { +class CConfigFile : public RefCounted<CConfigFile> { public: static Retained<CConfigFile> get_for_app(const String& app_name); static Retained<CConfigFile> get_for_system(const String& app_name); diff --git a/LibCore/CNetworkResponse.h b/LibCore/CNetworkResponse.h index 70bc30de15..df256201af 100644 --- a/LibCore/CNetworkResponse.h +++ b/LibCore/CNetworkResponse.h @@ -3,7 +3,7 @@ #include <AK/ByteBuffer.h> #include <AK/Retainable.h> -class CNetworkResponse : public Retainable<CNetworkResponse> { +class CNetworkResponse : public RefCounted<CNetworkResponse> { public: virtual ~CNetworkResponse(); diff --git a/LibGUI/GAction.h b/LibGUI/GAction.h index 02bca55e9a..7f6f8d8d9f 100644 --- a/LibGUI/GAction.h +++ b/LibGUI/GAction.h @@ -15,7 +15,7 @@ class GButton; class GMenuItem; class GWidget; -class GAction : public Retainable<GAction> +class GAction : public RefCounted<GAction> , public Weakable<GAction> { public: enum class ShortcutScope { diff --git a/LibGUI/GIcon.h b/LibGUI/GIcon.h index 47c09071d9..a509f9db18 100644 --- a/LibGUI/GIcon.h +++ b/LibGUI/GIcon.h @@ -3,7 +3,7 @@ #include <AK/HashMap.h> #include <SharedGraphics/GraphicsBitmap.h> -class GIconImpl : public Retainable<GIconImpl> { +class GIconImpl : public RefCounted<GIconImpl> { public: static Retained<GIconImpl> create() { return adopt(*new GIconImpl); } ~GIconImpl() {} diff --git a/LibGUI/GModel.h b/LibGUI/GModel.h index 7efa61375e..6e96e0a431 100644 --- a/LibGUI/GModel.h +++ b/LibGUI/GModel.h @@ -39,7 +39,7 @@ private: GModelIndex m_index; }; -class GModel : public Retainable<GModel> { +class GModel : public RefCounted<GModel> { public: struct ColumnMetadata { int preferred_width { 0 }; diff --git a/LibGUI/GVariant.cpp b/LibGUI/GVariant.cpp index bad6f9d3b6..3b65ace399 100644 --- a/LibGUI/GVariant.cpp +++ b/LibGUI/GVariant.cpp @@ -14,13 +14,13 @@ void GVariant::clear() { switch (m_type) { case Type::String: - AK::release_if_not_null(m_value.as_string); + AK::deref_if_not_null(m_value.as_string); break; case Type::Bitmap: - AK::release_if_not_null(m_value.as_bitmap); + AK::deref_if_not_null(m_value.as_bitmap); break; case Type::Icon: - AK::release_if_not_null(m_value.as_icon); + AK::deref_if_not_null(m_value.as_icon); break; default: break; @@ -51,21 +51,21 @@ GVariant::GVariant(const String& value) : m_type(Type::String) { m_value.as_string = const_cast<StringImpl*>(value.impl()); - AK::retain_if_not_null(m_value.as_string); + AK::ref_if_not_null(m_value.as_string); } GVariant::GVariant(const GraphicsBitmap& value) : m_type(Type::Bitmap) { m_value.as_bitmap = const_cast<GraphicsBitmap*>(&value); - AK::retain_if_not_null(m_value.as_bitmap); + AK::ref_if_not_null(m_value.as_bitmap); } GVariant::GVariant(const GIcon& value) : m_type(Type::Icon) { m_value.as_icon = &const_cast<GIconImpl&>(value.impl()); - AK::retain_if_not_null(m_value.as_icon); + AK::ref_if_not_null(m_value.as_icon); } GVariant::GVariant(Color color) @@ -133,15 +133,15 @@ void GVariant::copy_from(const GVariant& other) break; case Type::String: m_value.as_string = other.m_value.as_string; - AK::retain_if_not_null(m_value.as_bitmap); + AK::ref_if_not_null(m_value.as_bitmap); break; case Type::Bitmap: m_value.as_bitmap = other.m_value.as_bitmap; - AK::retain_if_not_null(m_value.as_bitmap); + AK::ref_if_not_null(m_value.as_bitmap); break; case Type::Icon: m_value.as_icon = other.m_value.as_icon; - AK::retain_if_not_null(m_value.as_icon); + AK::ref_if_not_null(m_value.as_icon); break; case Type::Color: m_value.as_color = other.m_value.as_color; diff --git a/LibHTML/CSS/StyleValue.h b/LibHTML/CSS/StyleValue.h index 1796f86b0b..3867fe4ffe 100644 --- a/LibHTML/CSS/StyleValue.h +++ b/LibHTML/CSS/StyleValue.h @@ -2,7 +2,7 @@ #include <AK/Retainable.h> -class StyleValue : public Retainable<StyleValue> { +class StyleValue : public RefCounted<StyleValue> { public: virtual ~StyleValue(); diff --git a/LibHTML/DOM/Node.cpp b/LibHTML/DOM/Node.cpp index 54880e68b4..c528dc2543 100644 --- a/LibHTML/DOM/Node.cpp +++ b/LibHTML/DOM/Node.cpp @@ -10,13 +10,13 @@ Node::~Node() { } -void Node::retain() +void Node::ref() { ASSERT(m_retain_count); ++m_retain_count; } -void Node::release() +void Node::deref() { ASSERT(m_retain_count); if (!--m_retain_count) diff --git a/LibHTML/DOM/Node.h b/LibHTML/DOM/Node.h index 3867bddbac..a021225f9e 100644 --- a/LibHTML/DOM/Node.h +++ b/LibHTML/DOM/Node.h @@ -18,9 +18,9 @@ class Node { public: virtual ~Node(); - void retain(); - void release(); - int retain_count() const { return m_retain_count; } + void ref(); + void deref(); + int ref_count() const { return m_retain_count; } ParentNode* parent_node() { return m_parent_node; } const ParentNode* parent_node() const { return m_parent_node; } diff --git a/LibHTML/Layout/LayoutNode.cpp b/LibHTML/Layout/LayoutNode.cpp index 2e441bdfc1..e6d858868a 100644 --- a/LibHTML/Layout/LayoutNode.cpp +++ b/LibHTML/Layout/LayoutNode.cpp @@ -9,13 +9,13 @@ LayoutNode::~LayoutNode() { } -void LayoutNode::retain() +void LayoutNode::ref() { ASSERT(m_retain_count); ++m_retain_count; } -void LayoutNode::release() +void LayoutNode::deref() { ASSERT(m_retain_count); if (!--m_retain_count) diff --git a/LibHTML/Layout/LayoutNode.h b/LibHTML/Layout/LayoutNode.h index 64341d86c5..3aa31e8f2a 100644 --- a/LibHTML/Layout/LayoutNode.h +++ b/LibHTML/Layout/LayoutNode.h @@ -11,9 +11,9 @@ class LayoutNode { public: virtual ~LayoutNode(); - void retain(); - void release(); - int retain_count() const { return m_retain_count; } + void ref(); + void deref(); + int ref_count() const { return m_retain_count; } const Rect& rect() const { return m_rect; } Rect& rect() { return m_rect; } diff --git a/Servers/WindowServer/WSCursor.h b/Servers/WindowServer/WSCursor.h index 889fdcdef1..e8437c808a 100644 --- a/Servers/WindowServer/WSCursor.h +++ b/Servers/WindowServer/WSCursor.h @@ -12,7 +12,7 @@ enum class WSStandardCursor { ResizeDiagonalBLTR, }; -class WSCursor : public Retainable<WSCursor> { +class WSCursor : public RefCounted<WSCursor> { public: static Retained<WSCursor> create(Retained<GraphicsBitmap>&&, const Point& hotspot); static Retained<WSCursor> create(Retained<GraphicsBitmap>&&); diff --git a/SharedGraphics/CharacterBitmap.h b/SharedGraphics/CharacterBitmap.h index e86f88fca8..bc8edac764 100644 --- a/SharedGraphics/CharacterBitmap.h +++ b/SharedGraphics/CharacterBitmap.h @@ -4,7 +4,7 @@ #include <AK/RetainPtr.h> #include <AK/Retainable.h> -class CharacterBitmap : public Retainable<CharacterBitmap> { +class CharacterBitmap : public RefCounted<CharacterBitmap> { public: static Retained<CharacterBitmap> create_from_ascii(const char* asciiData, unsigned width, unsigned height); ~CharacterBitmap(); diff --git a/SharedGraphics/Font.h b/SharedGraphics/Font.h index 85d91e3bea..f491ca1a6e 100644 --- a/SharedGraphics/Font.h +++ b/SharedGraphics/Font.h @@ -40,7 +40,7 @@ private: Size m_size; }; -class Font : public Retainable<Font> { +class Font : public RefCounted<Font> { public: static Font& default_font(); static Font& default_bold_font(); diff --git a/SharedGraphics/GraphicsBitmap.h b/SharedGraphics/GraphicsBitmap.h index 162517de2e..c011bb715e 100644 --- a/SharedGraphics/GraphicsBitmap.h +++ b/SharedGraphics/GraphicsBitmap.h @@ -10,7 +10,7 @@ #include <AK/StringView.h> #include <SharedBuffer.h> -class GraphicsBitmap : public Retainable<GraphicsBitmap> { +class GraphicsBitmap : public RefCounted<GraphicsBitmap> { public: enum class Format { Invalid, |