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

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

Issue 2454903002: Removed unused StyleEngine::didRemoveShadowRoot(). (Closed)
Patch Set: Created 4 years, 2 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 | « third_party/WebKit/Source/core/dom/StyleEngine.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/dom/StyleEngine.cpp
diff --git a/third_party/WebKit/Source/core/dom/StyleEngine.cpp b/third_party/WebKit/Source/core/dom/StyleEngine.cpp
index 27d80372c8c18532a0e09e740a25d1d8ed127395..d0ea794f197059fa36be21551eb20e27715b6a35 100644
--- a/third_party/WebKit/Source/core/dom/StyleEngine.cpp
+++ b/third_party/WebKit/Source/core/dom/StyleEngine.cpp
@@ -373,12 +373,6 @@ StyleEngine::activeStyleSheetsForInspector() const {
return activeStyleSheets;
}
-void StyleEngine::didRemoveShadowRoot(ShadowRoot* shadowRoot) {
- m_styleSheetCollectionMap.remove(shadowRoot);
- m_activeTreeScopes.remove(shadowRoot);
- m_dirtyTreeScopes.remove(shadowRoot);
-}
-
void StyleEngine::shadowRootRemovedFromDocument(ShadowRoot* shadowRoot) {
if (StyleResolver* styleResolver = resolver()) {
styleResolver->resetRuleFeatures();
@@ -445,13 +439,18 @@ void StyleEngine::clearResolver() {
DCHECK(isMaster() || !m_resolver);
document().clearScopedStyleResolver();
- // StyleEngine::shadowRootRemovedFromDocument removes not-in-document
- // treescopes from activeTreeScopes. StyleEngine::didRemoveShadowRoot
- // removes treescopes which are being destroyed from activeTreeScopes.
- // So we need to clearScopedStyleResolver for treescopes which have been
- // just removed from document. If document is destroyed before invoking
- // updateActiveStyleSheets, the treescope has a scopedStyleResolver which
- // has destroyed StyleSheetContents.
+ // TODO(rune@opera.com): The clearing of all shadow tree scoped style
+ // resolvers below should not be necessary. It was introduced to fix a crash
+ // bug (https://crbug.com/447976) when clearResolver is called from didDetach
+ // on document destruction. That was pre-oilpan, and removing the for-loop
+ // below does not re-introduce that crash. If m_activeTreeScopes keeps too
+ // much memory alive after detach, we should probably clear m_activeTreeScopes
+ // in didDetach instead.
+ //
+ // The current code will clear too much if clearResolver is called from
+ // clearMasterResolver as a result of a Reconstruct in
+ // DocumentStyleSheetCollection. Such a reconstruct should not necessarily
+ // affect scoped resolvers from shadow trees at all.
for (TreeScope* treeScope : m_activeTreeScopes)
treeScope->clearScopedStyleResolver();
« no previous file with comments | « third_party/WebKit/Source/core/dom/StyleEngine.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698