Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(148)

Unified Diff: third_party/WebKit/Source/core/dom/DocumentStyleSheetCollection.cpp

Issue 2096653004: Avoid stack allocating StyleSheetCollections. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/dom/ShadowTreeStyleSheetCollection.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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)
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/dom/ShadowTreeStyleSheetCollection.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698