Bug 1287155 - Fix build bustage when --disable-debug is combined with --enable-logrefcnt. r?froydnj draft
authorKartikaya Gupta <kgupta@mozilla.com>
Mon, 18 Jul 2016 11:22:03 -0400
changeset 389059 99f3867e5a441d8318db24007143b117206de9fa
parent 389058 cde56ead650fd302be1d440507485b9abf7c163a
child 525651 7496cc7c7f5dca16d1ea981702a6f89f78857a5f
push id23293
push userkgupta@mozilla.com
push dateMon, 18 Jul 2016 15:22:58 +0000
reviewersfroydnj
bugs1287155
milestone50.0a1
Bug 1287155 - Fix build bustage when --disable-debug is combined with --enable-logrefcnt. r?froydnj MozReview-Commit-ID: 9HZcYrsvvHX
gfx/layers/AtomicRefCountedWithFinalize.h
--- 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