Bug 1109437 - Remove MOZ_COUNT_{C,D}TOR on refcounted promise classes. r=cpearce
authorBobby Holley <bobbyholley@gmail.com>
Mon, 22 Dec 2014 00:20:30 -0800
changeset 220826 9072cf5c5bb83f99b3934490e2366d2a26d6e94e
parent 220825 0df4c88a32d277fff5cf2965075106c1608a8579
child 220827 ef08b3ad6fe0eab23bcffa97c0b3fdb39255c769
push id53203
push userbobbyholley@gmail.com
push dateMon, 22 Dec 2014 08:20:48 +0000
treeherdermozilla-inbound@cb95d7109ba9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscpearce
bugs1109437
milestone37.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1109437 - Remove MOZ_COUNT_{C,D}TOR on refcounted promise classes. r=cpearce These were accidental and redundant, because refcounted classes get this behavior automatically. And this is very lucky, because it turns out that our MOZ_COUNT_* infrastructure can't handle varying-sized instances identified with the same string, which is exactly what we can get with these templated types. The only remaining use of these macros is on the non-templated ThenValueBase, which is happily not variable-sized. \o/
dom/media/MediaPromise.h
--- a/dom/media/MediaPromise.h
+++ b/dom/media/MediaPromise.h
@@ -56,17 +56,16 @@ public:
   typedef ResolveValueT ResolveValueType;
   typedef RejectValueT RejectValueType;
 
   NS_INLINE_DECL_THREADSAFE_REFCOUNTING(MediaPromise)
   explicit MediaPromise(const char* aCreationSite)
     : mCreationSite(aCreationSite)
     , mMutex("MediaPromise Mutex")
   {
-    MOZ_COUNT_CTOR(MediaPromise);
     PROMISE_LOG("%s creating MediaPromise (%p)", mCreationSite, this);
   }
 
   static nsRefPtr<MediaPromise<ResolveValueT, RejectValueT>>
   CreateAndResolve(ResolveValueType aResolveValue, const char* aResolveSite)
   {
     nsRefPtr<MediaPromise<ResolveValueT, RejectValueT>> p =
       new MediaPromise<ResolveValueT, RejectValueT>(aResolveSite);
@@ -94,24 +93,20 @@ protected:
   class ThenValueBase
   {
   public:
     class ResolveRunnable : public nsRunnable
     {
     public:
       ResolveRunnable(ThenValueBase* aThenValue, ResolveValueType aResolveValue)
         : mThenValue(aThenValue)
-        , mResolveValue(aResolveValue)
-      {
-        MOZ_COUNT_CTOR(ResolveRunnable);
-      }
+        , mResolveValue(aResolveValue) {}
 
       ~ResolveRunnable()
       {
-        MOZ_COUNT_DTOR(ResolveRunnable);
         MOZ_ASSERT(!mThenValue);
       }
 
       NS_IMETHODIMP Run()
       {
         PROMISE_LOG("ResolveRunnable::Run() [this=%p]", this);
         mThenValue->DoResolve(mResolveValue);
 
@@ -125,24 +120,20 @@ protected:
       ResolveValueType mResolveValue;
     };
 
     class RejectRunnable : public nsRunnable
     {
     public:
       RejectRunnable(ThenValueBase* aThenValue, RejectValueType aRejectValue)
         : mThenValue(aThenValue)
-        , mRejectValue(aRejectValue)
-      {
-        MOZ_COUNT_CTOR(RejectRunnable);
-      }
+        , mRejectValue(aRejectValue) {}
 
       ~RejectRunnable()
       {
-        MOZ_COUNT_DTOR(RejectRunnable);
         MOZ_ASSERT(!mThenValue);
       }
 
       NS_IMETHODIMP Run()
       {
         PROMISE_LOG("RejectRunnable::Run() [this=%p]", this);
         mThenValue->DoReject(mRejectValue);
 
@@ -322,17 +313,16 @@ protected:
       aOther->Resolve(mResolveValue.ref(), "<chained promise>");
     } else {
       aOther->Reject(mRejectValue.ref(), "<chained promise>");
     }
   }
 
   ~MediaPromise()
   {
-    MOZ_COUNT_DTOR(MediaPromise);
     PROMISE_LOG("MediaPromise::~MediaPromise [this=%p]", this);
     MOZ_ASSERT(!IsPending());
     MOZ_ASSERT(mThenValues.IsEmpty());
     MOZ_ASSERT(mChainedPromises.IsEmpty());
   };
 
   const char* mCreationSite; // For logging
   Mutex mMutex;