Index: third_party/WebKit/Source/core/dom/DocumentStyleSheetCollection.cpp |
diff --git a/third_party/WebKit/Source/core/dom/DocumentStyleSheetCollection.cpp b/third_party/WebKit/Source/core/dom/DocumentStyleSheetCollection.cpp |
index 7558369fd2e0fc9709b130fb0c88d59c9e98bf3b..ff64c3a80d1dce3f5925703e4c2d7f7724355299 100644 |
--- a/third_party/WebKit/Source/core/dom/DocumentStyleSheetCollection.cpp |
+++ b/third_party/WebKit/Source/core/dom/DocumentStyleSheetCollection.cpp |
@@ -88,12 +88,13 @@ void DocumentStyleSheetCollection::collectStyleSheets(StyleEngine& engine, Docum |
void DocumentStyleSheetCollection::updateActiveStyleSheets(StyleEngine& engine, StyleResolverUpdateMode updateMode) |
{ |
- StyleSheetCollection collection; |
- ActiveDocumentStyleSheetCollector collector(collection); |
+ // StyleSheetCollection is GarbageCollected<>, allocate it on the heap. |
+ StyleSheetCollection* collection = StyleSheetCollection::create(); |
+ ActiveDocumentStyleSheetCollector collector(*collection); |
collectStyleSheets(engine, collector); |
StyleSheetChange change; |
- analyzeStyleSheetChange(updateMode, collection, change); |
+ analyzeStyleSheetChange(updateMode, collection->activeAuthorStyleSheets(), change); |
if (change.styleResolverUpdateType == Reconstruct) { |
engine.clearMasterResolver(); |
@@ -109,15 +110,16 @@ void DocumentStyleSheetCollection::updateActiveStyleSheets(StyleEngine& engine, |
styleResolver->resetAuthorStyle(treeScope()); |
engine.removeFontFaceRules(change.fontFaceRulesToRemove); |
styleResolver->removePendingAuthorStyleSheets(m_activeAuthorStyleSheets); |
- styleResolver->lazyAppendAuthorStyleSheets(0, collection.activeAuthorStyleSheets()); |
+ styleResolver->lazyAppendAuthorStyleSheets(0, collection->activeAuthorStyleSheets()); |
} else { |
- styleResolver->lazyAppendAuthorStyleSheets(m_activeAuthorStyleSheets.size(), collection.activeAuthorStyleSheets()); |
+ styleResolver->lazyAppendAuthorStyleSheets(m_activeAuthorStyleSheets.size(), collection->activeAuthorStyleSheets()); |
} |
} |
if (change.requiresFullStyleRecalc) |
document().setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing::create(StyleChangeReason::ActiveStylesheetsUpdate)); |
- collection.swap(*this); |
+ collection->swap(*this); |
+ collection->dispose(); |
} |
DEFINE_TRACE_WRAPPERS(DocumentStyleSheetCollection) |