Bug 1402499 - Add NS_IMPL_ISUPPORTS_CYCLE_COLLECTION_INHERITED_0 draft
authorKyle Machulis <kyle@nonpolynomial.com>
Thu, 28 Sep 2017 23:21:09 -0700
changeset 672833 75fa5ab60020c36086a0bb71af2bb2c5b2395367
parent 672740 5b614965e23e21272c9d7fcd8e0911956d98d543
child 672834 83e86c37a25899024990c7514e2fc045948666b6
push id82382
push userbmo:kyle@nonpolynomial.com
push dateFri, 29 Sep 2017 19:59:29 +0000
bugs1402499
milestone58.0a1
Bug 1402499 - Add NS_IMPL_ISUPPORTS_CYCLE_COLLECTION_INHERITED_0 Add macro for nsISupports inheriting classes that need cycle collection and only inherit from one parent, with no interface table needed. Takes care of map and addref/release calls. MozReview-Commit-ID: LtTwYH0DeEz
xpcom/base/nsCycleCollectionParticipant.h
--- a/xpcom/base/nsCycleCollectionParticipant.h
+++ b/xpcom/base/nsCycleCollectionParticipant.h
@@ -964,16 +964,21 @@ static NS_CYCLE_COLLECTION_INNERCLASS NS
   NS_INTERFACE_TABLE_INHERITED(aClass, __VA_ARGS__)                             \
   NS_INTERFACE_TABLE_TAIL_INHERITING(aSuper)
 
 #define NS_IMPL_ISUPPORTS_CYCLE_COLLECTION_INHERITED(aClass, aSuper, ...)         \
   NS_IMPL_QUERY_INTERFACE_CYCLE_COLLECTION_INHERITED(aClass, aSuper, __VA_ARGS__) \
   NS_IMPL_ADDREF_INHERITED(aClass, aSuper)                                        \
   NS_IMPL_RELEASE_INHERITED(aClass, aSuper)
 
+#define NS_IMPL_ISUPPORTS_CYCLE_COLLECTION_INHERITED_0(aClass, aSuper)            \
+  NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(aClass)                                 \
+  NS_INTERFACE_MAP_END_INHERITING(aSuper)                                         \
+  NS_IMPL_ADDREF_INHERITED(aClass, aSuper)                                        \
+  NS_IMPL_RELEASE_INHERITED(aClass, aSuper)
 
 /**
  * Equivalency of the high three words where two IIDs have the same
  * top three words but not the same low word.
  */
 inline bool TopThreeWordsEquals(const nsID& aID,
                                 const nsID& aOther1,
                                 const nsID& aOther2)