1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 09:57:35 +00:00

AK: Use unsigned int for refcount

And while fixing all the tests that look at ref_count(),
sneak in a fix for the test suite name.
This commit is contained in:
Sergey Bugaev 2020-06-12 16:33:38 +03:00 committed by Andreas Kling
parent 0466810638
commit 583108004c
3 changed files with 29 additions and 27 deletions

View file

@ -58,22 +58,24 @@ constexpr auto call_one_ref_left_if_present(...) -> FalseType
class RefCountedBase {
public:
typedef unsigned int RefCountType;
ALWAYS_INLINE void ref() const
{
ASSERT(m_ref_count);
++m_ref_count;
}
ALWAYS_INLINE int ref_count() const
ALWAYS_INLINE RefCountType ref_count() const
{
return m_ref_count;
}
protected:
RefCountedBase() {}
RefCountedBase() { }
ALWAYS_INLINE ~RefCountedBase()
{
ASSERT(!m_ref_count);
ASSERT(m_ref_count == 0);
}
ALWAYS_INLINE void deref_base() const
@ -82,7 +84,7 @@ protected:
--m_ref_count;
}
mutable int m_ref_count { 1 };
mutable RefCountType m_ref_count { 1 };
};
template<typename T>