Bug 1508099 Part 1 - Add macros for recording refcounts on non-nsISupports classes, r=froydnj.
authorBrian Hackett <bhackett1024@gmail.com>
Sat, 17 Nov 2018 12:54:55 -1000
changeset 507400 456275c5ddac8e6c7cd9a71a4f10ed56c0f1bfc3
parent 507285 510f4bccd603a6a64b514e174c5d9e52d7afd185
child 507401 98430e6d541b8e5ffd0492d84afd5c031eb79905
push id1905
push userffxbld-merge
push dateMon, 21 Jan 2019 12:33:13 +0000
treeherdermozilla-release@c2fca1944d8c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1508099
milestone65.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 1508099 Part 1 - Add macros for recording refcounts on non-nsISupports classes, r=froydnj.
xpcom/base/nsISupportsImpl.h
--- a/xpcom/base/nsISupportsImpl.h
+++ b/xpcom/base/nsISupportsImpl.h
@@ -606,17 +606,17 @@ public:
  * given non-XPCOM <i>_class</i>.
  *
  * @param _class The name of the class implementing the method
  * @param optional override Mark the AddRef & Release methods as overrides.
  */
 #define NS_INLINE_DECL_REFCOUNTING(_class, ...)                               \
   NS_INLINE_DECL_REFCOUNTING_WITH_DESTROY(_class, delete(this), __VA_ARGS__)
 
-#define NS_INLINE_DECL_THREADSAFE_REFCOUNTING_META(_class, _decl, ...)        \
+#define NS_INLINE_DECL_THREADSAFE_REFCOUNTING_META(_class, _decl, _recording, ...) \
 public:                                                                       \
   _decl(MozExternalRefCountType) AddRef(void) __VA_ARGS__ {                   \
     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;                                                  \
   }                                                                           \
@@ -627,36 +627,58 @@ public:                                 
     if (count == 0) {                                                         \
       delete (this);                                                          \
       return 0;                                                               \
     }                                                                         \
     return count;                                                             \
   }                                                                           \
   typedef mozilla::TrueType HasThreadSafeRefCnt;                              \
 protected:                                                                    \
-  ::mozilla::ThreadSafeAutoRefCnt mRefCnt;                                    \
+  ::mozilla::ThreadSafeAutoRefCntWithRecording<_recording> mRefCnt;           \
 public:
 
 /**
  * Use this macro to declare and implement the AddRef & Release methods for a
  * given non-XPCOM <i>_class</i> in a threadsafe manner.
  *
  * DOES NOT DO REFCOUNT STABILIZATION!
  *
  * @param _class The name of the class implementing the method
  */
 #define NS_INLINE_DECL_THREADSAFE_REFCOUNTING(_class, ...)                    \
-NS_INLINE_DECL_THREADSAFE_REFCOUNTING_META(_class, NS_METHOD_, __VA_ARGS__)
+NS_INLINE_DECL_THREADSAFE_REFCOUNTING_META(_class, NS_METHOD_,                \
+                                           mozilla::recordreplay::Behavior::DontPreserve, \
+                                           __VA_ARGS__)
 
 /**
  * Like NS_INLINE_DECL_THREADSAFE_REFCOUNTING with AddRef & Release declared
  * virtual.
  */
 #define NS_INLINE_DECL_THREADSAFE_VIRTUAL_REFCOUNTING(_class, ...)            \
-NS_INLINE_DECL_THREADSAFE_REFCOUNTING_META(_class, NS_IMETHOD_, __VA_ARGS__)
+NS_INLINE_DECL_THREADSAFE_REFCOUNTING_META(_class, NS_IMETHOD_,               \
+                                           mozilla::recordreplay::Behavior::DontPreserve, \
+                                           __VA_ARGS__)
+
+/**
+ * Like NS_INLINE_DECL_THREADSAFE_REFCOUNTING except that reference changes
+ * are recorded and replayed.
+ */
+#define NS_INLINE_DECL_THREADSAFE_REFCOUNTING_RECORDED(_class, ...)           \
+NS_INLINE_DECL_THREADSAFE_REFCOUNTING_META(_class, NS_METHOD_,                \
+                                           mozilla::recordreplay::Behavior::Preserve, \
+                                           __VA_ARGS__)
+
+/**
+ * Like NS_INLINE_DECL_THREADSAFE_VIRTUAL_REFCOUNTING except that reference
+ * changes are recorded and replayed.
+ */
+#define NS_INLINE_DECL_THREADSAFE_VIRTUAL_REFCOUNTING_RECORDED(_class, ...)   \
+NS_INLINE_DECL_THREADSAFE_REFCOUNTING_META(_class, NS_IMETHOD_,               \
+                                           mozilla::recordreplay::Behavior::Preserve, \
+                                           __VA_ARGS__)
 
 /**
  * Use this macro in interface classes that you want to be able to reference
  * using RefPtr, but don't want to provide a refcounting implemenation. The
  * refcounting implementation can be provided by concrete subclasses that
  * implement the interface.
  */
 #define NS_INLINE_DECL_PURE_VIRTUAL_REFCOUNTING                               \