Bug 1287155 - Fix build bustage when --disable-debug is combined with --enable-logrefcnt. r?froydnj
MozReview-Commit-ID: 9HZcYrsvvHX
--- a/gfx/layers/AtomicRefCountedWithFinalize.h
+++ b/gfx/layers/AtomicRefCountedWithFinalize.h
@@ -36,16 +36,18 @@ protected:
explicit AtomicRefCountedWithFinalize(const char* aName)
: mRecycleCallback(nullptr)
, mRefCount(0)
, mMessageLoopToPostDestructionTo(nullptr)
#ifdef DEBUG
, mSpew(false)
, mManualAddRefs(0)
, mManualReleases(0)
+#endif
+#ifdef NS_BUILD_REFCNT_LOGGING
, mName(aName)
#endif
{}
~AtomicRefCountedWithFinalize() {
if (mRefCount >= 0) {
gfxCriticalError() << "Deleting referenced object? " << mRefCount;
}
@@ -105,18 +107,18 @@ public:
(void)lineNum;
#endif
Release();
}
private:
void AddRef() {
MOZ_ASSERT(mRefCount >= 0, "AddRef() during/after Finalize()/dtor.");
- DebugOnly<int> count = ++mRefCount;
- NS_LOG_ADDREF(this, count, mName, sizeof(*this));
+ mRefCount++;
+ NS_LOG_ADDREF(this, mRefCount, mName, sizeof(*this));
}
void Release() {
MOZ_ASSERT(mRefCount > 0, "Release() during/after Finalize()/dtor.");
// Read mRecycleCallback early so that it does not get set to
// deleted memory, if the object is goes away. See bug 994903.
// This saves us in the case where there is no callback, so that
// we can do the "else if" below.
@@ -199,15 +201,17 @@ private:
Atomic<int> mRefCount;
MessageLoop *mMessageLoopToPostDestructionTo;
#ifdef DEBUG
public:
bool mSpew;
private:
Atomic<uint32_t> mManualAddRefs;
Atomic<uint32_t> mManualReleases;
+#endif
+#ifdef NS_BUILD_REFCNT_LOGGING
const char* mName;
#endif
};
} // namespace mozilla
#endif