Bug 1184283 - nsISupports pure virtual refcounting draft
authorVladimir Vukicevic <vladimir@pobox.com>
Mon, 25 Jan 2016 16:54:13 -0500
changeset 356567 46fb61199badf0b9c9d0d11d0f178ee4e8862be5
parent 356566 1b94eaca0cdb7be4574d1b6ae49edf65e23f5111
child 356568 712d8711e762ab21d41c6734a0824a19dcd2980c
push id16548
push userbmo:vladimir@pobox.com
push dateTue, 26 Apr 2016 17:19:15 +0000
bugs1184283
milestone49.0a1
Bug 1184283 - nsISupports pure virtual refcounting
xpcom/glue/nsISupportsImpl.h
--- a/xpcom/glue/nsISupportsImpl.h
+++ b/xpcom/glue/nsISupportsImpl.h
@@ -555,16 +555,25 @@ NS_INLINE_DECL_THREADSAFE_REFCOUNTING_ME
 /**
  * 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__)
 
 /**
+ * Use this macro to declare pure virtual AddRef & Release methods, for
+ * implementation by derived classes.
+ */
+#define NS_INLINE_DECL_PURE_VIRTUAL_REFCOUNTING                               \
+public:                                                                       \
+  NS_IMETHOD_(MozExternalRefCountType) AddRef(void) = 0;                      \
+  NS_IMETHOD_(MozExternalRefCountType) Release(void) = 0;
+
+/**
  * Use this macro to implement the AddRef method for a given <i>_class</i>
  * @param _class The name of the class implementing the method
  */
 #define NS_IMPL_ADDREF(_class)                                                \
 NS_IMETHODIMP_(MozExternalRefCountType) _class::AddRef(void)                  \
 {                                                                             \
   MOZ_ASSERT_TYPE_OK_FOR_REFCOUNTING(_class)                                  \
   MOZ_ASSERT(int32_t(mRefCnt) >= 0, "illegal refcnt");                        \