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

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

Issue 2593643002: Clear active tree scopes on StyleEngine::didDetach(). (Closed)
Patch Set: Rebased Created 4 years 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 b5af1480b0c2bdb212949ff1d9f2de946d283877..10a0ccb96769e49e0b6be81ff79ce68a4aa012d0 100644
--- a/third_party/WebKit/Source/core/dom/StyleEngine.cpp
+++ b/third_party/WebKit/Source/core/dom/StyleEngine.cpp
@@ -426,28 +426,14 @@ void StyleEngine::createResolver() {
m_resolver->setRuleUsageTracker(m_tracker);
}
-void StyleEngine::clearResolver() {
+void StyleEngine::clearResolvers() {
DCHECK(!document().inStyleRecalc());
DCHECK(isMaster() || !m_resolver);
document().clearScopedStyleResolver();
- // 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();
- m_treeBoundaryCrossingScopes.clear();
-
if (m_resolver) {
TRACE_EVENT1("blink", "StyleEngine::clearResolver", "frame",
document().frame());
@@ -457,8 +443,11 @@ void StyleEngine::clearResolver() {
}
void StyleEngine::didDetach() {
+ clearResolvers();
m_globalRuleSet.dispose();
- clearResolver();
+ m_treeBoundaryCrossingScopes.clear();
+ m_dirtyTreeScopes.clear();
+ m_activeTreeScopes.clear();
m_viewportResolver = nullptr;
m_mediaQueryEvaluator = nullptr;
clearFontCache();
« 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