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
--- 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