Bug 1304302 part 6 - Add cycle collecting support to pointer of StyleSheet. r?smaug draft
authorXidorn Quan <me@upsuper.org>
Mon, 26 Sep 2016 09:26:58 +1000
changeset 417489 51fdc11721bef68046480ac45ef2c0539e8f97af
parent 416884 b3b854b0d20a72a95527d505386b59b7c50fe684
child 417490 72647db10ffd6bee3c53fe68e99c50329228bfca
push id30405
push userxquan@mozilla.com
push dateSun, 25 Sep 2016 23:29:22 +0000
reviewerssmaug
bugs1304302, 1292432
milestone51.0a1
Bug 1304302 part 6 - Add cycle collecting support to pointer of StyleSheet. r?smaug This is mostly copied from StyleSheetHandle which is being removed in later patches. This is a temporary workaround to keep things working. It should be removed soon when StyleSheet itself becomes a subclass of nsISupports (which is expected to happen in bug 1292432). MozReview-Commit-ID: Gqv0eRZgja5
layout/style/StyleSheetInlines.h
--- a/layout/style/StyleSheetInlines.h
+++ b/layout/style/StyleSheetInlines.h
@@ -192,11 +192,29 @@ StyleSheet::List(FILE* aOut, int32_t aIn
 {
   FORWARD(List, (aOut, aIndex))
 }
 #endif
 
 #undef FORWARD
 #undef FORWARD_CONCRETE
 
+inline void
+ImplCycleCollectionTraverse(nsCycleCollectionTraversalCallback& aCallback,
+                            RefPtr<StyleSheet>& aField,
+                            const char* aName,
+                            uint32_t aFlags = 0)
+{
+  if (aField && aField->IsGecko()) {
+    NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(aCallback, aName);
+    aCallback.NoteXPCOMChild(NS_ISUPPORTS_CAST(nsIDOMCSSStyleSheet*, aField->AsGecko()));
+  }
+}
+
+inline void
+ImplCycleCollectionUnlink(RefPtr<StyleSheet>& aField)
+{
+  aField = nullptr;
+}
+
 }
 
 #endif // mozilla_StyleSheetInlines_h