From ca0d37e8d5a01473be5264985b8c9f071eac2026 Mon Sep 17 00:00:00 2001 From: Nika Layzell Date: Fri, 14 Jul 2023 16:20:53 +0000 Subject: [PATCH] Bug 1842658 - Part 1: Use a refcounting macro for imgCacheEntry, r=tnikkel It appears that when this was originally added in bug 430061, the inline refcounting macros didn't exist yet. Differential Revision: https://phabricator.services.mozilla.com/D183203 --- image/imgLoader.h | 28 +++------------------------- 1 file changed, 3 insertions(+), 25 deletions(-) diff --git a/image/imgLoader.h b/image/imgLoader.h index 168b47333366..6b8f3a56d033 100644 --- a/image/imgLoader.h +++ b/image/imgLoader.h @@ -42,30 +42,10 @@ class Document; class imgCacheEntry { public: + NS_INLINE_DECL_REFCOUNTING(imgCacheEntry) + imgCacheEntry(imgLoader* loader, imgRequest* request, bool aForcePrincipalCheck); - ~imgCacheEntry(); - - nsrefcnt AddRef() { - MOZ_ASSERT(int32_t(mRefCnt) >= 0, "illegal refcnt"); - NS_ASSERT_OWNINGTHREAD(imgCacheEntry); - ++mRefCnt; - NS_LOG_ADDREF(this, mRefCnt, "imgCacheEntry", sizeof(*this)); - return mRefCnt; - } - - nsrefcnt Release() { - MOZ_ASSERT(0 != mRefCnt, "dup release"); - NS_ASSERT_OWNINGTHREAD(imgCacheEntry); - --mRefCnt; - NS_LOG_RELEASE(this, mRefCnt, "imgCacheEntry"); - if (mRefCnt == 0) { - mRefCnt = 1; /* stabilize */ - delete this; - return 0; - } - return mRefCnt; - } uint32_t GetDataSize() const { return mDataSize; } void SetDataSize(uint32_t aDataSize) { @@ -127,11 +107,9 @@ class imgCacheEntry { // Private, unimplemented copy constructor. imgCacheEntry(const imgCacheEntry&); + ~imgCacheEntry(); private: // data - nsAutoRefCnt mRefCnt; - NS_DECL_OWNINGTHREAD - imgLoader* mLoader; RefPtr mRequest; uint32_t mDataSize;