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

Unified Diff: third_party/WebKit/Source/core/css/resolver/ScopedStyleResolver.cpp

Issue 1382353002: Oilpan: promptly dispose style resolvers upon clearing. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Only expose dispose()s to Oilpan Created 5 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
Index: third_party/WebKit/Source/core/css/resolver/ScopedStyleResolver.cpp
diff --git a/third_party/WebKit/Source/core/css/resolver/ScopedStyleResolver.cpp b/third_party/WebKit/Source/core/css/resolver/ScopedStyleResolver.cpp
index 731252ae344cbe14f5a9a6329b3abc8fd2771a73..358875b80b8b611ca7ad6958f6d9bcc743459e8a 100644
--- a/third_party/WebKit/Source/core/css/resolver/ScopedStyleResolver.cpp
+++ b/third_party/WebKit/Source/core/css/resolver/ScopedStyleResolver.cpp
@@ -46,6 +46,24 @@
namespace blink {
+#if ENABLE(OILPAN)
+void ScopedStyleResolver::dispose()
+{
+ m_keyframesRuleMap.clear();
+
+ if (m_treeBoundaryCrossingRuleSet) {
+ for (size_t i = 0; i < m_treeBoundaryCrossingRuleSet->size(); ++i) {
+ if (RuleSet* ruleSet = m_treeBoundaryCrossingRuleSet->at(i)->m_ruleSet.get())
+ ruleSet->dispose();
+ }
+
+ m_treeBoundaryCrossingRuleSet->clear();
+ m_treeBoundaryCrossingRuleSet.clear();
+ }
+
+}
+#endif
+
ScopedStyleResolver* ScopedStyleResolver::parent() const
{
for (TreeScope* scope = treeScope().parentTreeScope(); scope; scope = scope->parentTreeScope()) {
@@ -71,12 +89,13 @@ void ScopedStyleResolver::addFontFaceRules(const RuleSet& ruleSet)
Document& document = treeScope().document();
CSSFontSelector* cssFontSelector = document.styleEngine().fontSelector();
const WillBeHeapVector<RawPtrWillBeMember<StyleRuleFontFace>> fontFaceRules = ruleSet.fontFaceRules();
+ if (!fontFaceRules.size())
+ return;
for (auto& fontFaceRule : fontFaceRules) {
if (RefPtrWillBeRawPtr<FontFace> fontFace = FontFace::create(&document, fontFaceRule))
cssFontSelector->fontFaceCache()->add(cssFontSelector, fontFaceRule, fontFace);
}
- if (fontFaceRules.size())
- document.styleResolver()->invalidateMatchedPropertiesCache();
+ document.styleResolver()->invalidateMatchedPropertiesCache();
}
void ScopedStyleResolver::appendCSSStyleSheet(CSSStyleSheet& cssSheet, const MediaQueryEvaluator& medium)

Powered by Google App Engine
This is Rietveld 408576698