Bug 1486562 - Record reference count changes for SourceListener, r=jib.
authorBrian Hackett <bhackett1024@gmail.com>
Fri, 31 Aug 2018 05:24:09 -1000
changeset 434425 641bced4e9865e99488f5f222ae774d4e69db4ce
parent 434424 dcecbdfea1143b1ff7e2fdd8466fbc7c5ec393e2
child 434426 abd2efff1efd248ab56ee570edabc2def41b0f6c
push id34557
push userdluca@mozilla.com
push dateSun, 02 Sep 2018 21:34:34 +0000
treeherdermozilla-central@634b562ae2c3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjib
bugs1486562
milestone63.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 1486562 - Record reference count changes for SourceListener, r=jib.
dom/media/MediaManager.cpp
gfx/layers/ipc/ThreadSafeRefcountingWithMainThreadDestruction.h
--- a/dom/media/MediaManager.cpp
+++ b/dom/media/MediaManager.cpp
@@ -337,17 +337,18 @@ CallOnSuccess(MediaManager::GetUserMedia
  * clears this on XPCOM_WILL_SHUTDOWN, before MediaManager enters shutdown.
  */
 class SourceListener : public SupportsWeakPtr<SourceListener> {
 public:
   typedef MozPromise<bool /* aIgnored */, Maybe<nsString>, true> ApplyConstraintsPromise;
   typedef MozPromise<bool /* aIgnored */, RefPtr<MediaMgrError>, true> InitPromise;
 
   MOZ_DECLARE_WEAKREFERENCE_TYPENAME(SourceListener)
-  NS_INLINE_DECL_THREADSAFE_REFCOUNTING_WITH_MAIN_THREAD_DESTRUCTION(SourceListener)
+  NS_INLINE_DECL_THREADSAFE_REFCOUNTING_WITH_MAIN_THREAD_DESTRUCTION_AND_RECORDING(SourceListener,
+                                                                                   recordreplay::Behavior::Preserve)
 
   SourceListener();
 
   /**
    * Registers this source listener as belonging to the given window listener.
    */
   void Register(GetUserMediaWindowListener* aListener);
 
--- a/gfx/layers/ipc/ThreadSafeRefcountingWithMainThreadDestruction.h
+++ b/gfx/layers/ipc/ThreadSafeRefcountingWithMainThreadDestruction.h
@@ -54,17 +54,17 @@ struct DeleteOnMainThreadTask : public R
     mToDelete->DeleteToBeCalledOnMainThread();
     return NS_OK;
   }
 };
 
 } // namespace layers
 } // namespace mozilla
 
-#define NS_INLINE_DECL_THREADSAFE_REFCOUNTING_WITH_MAIN_THREAD_DESTRUCTION(_class) \
+#define NS_INLINE_DECL_THREADSAFE_REFCOUNTING_WITH_MAIN_THREAD_DESTRUCTION_AND_RECORDING(_class, _recording) \
 public:                                                                       \
   NS_METHOD_(MozExternalRefCountType) AddRef(void) {                          \
     MOZ_ASSERT_TYPE_OK_FOR_REFCOUNTING(_class)                                \
     MOZ_ASSERT(int32_t(mRefCnt) >= 0, "illegal refcnt");                      \
     nsrefcnt count = ++mRefCnt;                                               \
     NS_LOG_ADDREF(this, count, #_class, sizeof(*this));                       \
     return (nsrefcnt) count;                                                  \
   }                                                                           \
@@ -84,14 +84,18 @@ public:                                 
           new mozilla::layers::DeleteOnMainThreadTask<_class>(this));         \
       }                                                                       \
     } else {                                                                  \
       NS_LOG_RELEASE(this, count, #_class);                                   \
     }                                                                         \
     return count;                                                             \
   }                                                                           \
 protected:                                                                    \
-  ::mozilla::ThreadSafeAutoRefCnt mRefCnt;                                    \
+  ::mozilla::ThreadSafeAutoRefCntWithRecording<_recording> mRefCnt;           \
 private:                                                                      \
   ::mozilla::layers::HelperForMainThreadDestruction mHelperForMainThreadDestruction; \
 public:
 
+#define NS_INLINE_DECL_THREADSAFE_REFCOUNTING_WITH_MAIN_THREAD_DESTRUCTION(_class) \
+  NS_INLINE_DECL_THREADSAFE_REFCOUNTING_WITH_MAIN_THREAD_DESTRUCTION_AND_RECORDING \
+    (_class, recordreplay::Behavior::DontPreserve)
+
 #endif