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

Side by Side Diff: third_party/WebKit/Source/core/css/resolver/StyleResolver.cpp

Issue 1382353002: Oilpan: promptly dispose style resolvers upon clearing. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) 3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com)
4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) 4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com)
5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved. 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved.
6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> 6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> 7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org>
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. 9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved.
10 * Copyright (C) Research In Motion Limited 2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2011. All rights reserved.
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 m_medium = adoptPtr(new MediaQueryEvaluator("all")); 156 m_medium = adoptPtr(new MediaQueryEvaluator("all"));
157 } 157 }
158 158
159 initWatchedSelectorRules(); 159 initWatchedSelectorRules();
160 } 160 }
161 161
162 StyleResolver::~StyleResolver() 162 StyleResolver::~StyleResolver()
163 { 163 {
164 } 164 }
165 165
166 void StyleResolver::dispose()
167 {
168 m_features.clear();
169 if (m_siblingRuleSet) {
170 m_siblingRuleSet->dispose();
171 m_siblingRuleSet.clear();
172 }
173 if (m_uncommonAttributeRuleSet) {
174 m_uncommonAttributeRuleSet->dispose();
175 m_uncommonAttributeRuleSet.clear();
176 }
177 m_styleSharingLists.clear();
178 if (m_watchedSelectorsRules) {
179 m_watchedSelectorsRules->dispose();
180 m_watchedSelectorsRules.clear();
181 }
182 m_pendingStyleSheets.clear();
183 }
184
166 void StyleResolver::initWatchedSelectorRules() 185 void StyleResolver::initWatchedSelectorRules()
167 { 186 {
168 CSSSelectorWatch* watch = CSSSelectorWatch::fromIfExists(*m_document); 187 CSSSelectorWatch* watch = CSSSelectorWatch::fromIfExists(*m_document);
169 if (!watch) 188 if (!watch)
170 return; 189 return;
171 const WillBeHeapVector<RefPtrWillBeMember<StyleRule>>& watchedSelectors = wa tch->watchedCallbackSelectors(); 190 const WillBeHeapVector<RefPtrWillBeMember<StyleRule>>& watchedSelectors = wa tch->watchedCallbackSelectors();
172 if (!watchedSelectors.size()) 191 if (!watchedSelectors.size())
173 return; 192 return;
174 m_watchedSelectorsRules = RuleSet::create(); 193 m_watchedSelectorsRules = RuleSet::create();
175 for (unsigned i = 0; i < watchedSelectors.size(); ++i) 194 for (unsigned i = 0; i < watchedSelectors.size(); ++i)
(...skipping 1278 matching lines...) Expand 10 before | Expand all | Expand 10 after
1454 1473
1455 for (CSSPropertyID property : properties) { 1474 for (CSSPropertyID property : properties) {
1456 if (property == CSSPropertyLineHeight) 1475 if (property == CSSPropertyLineHeight)
1457 updateFont(state); 1476 updateFont(state);
1458 StyleBuilder::applyProperty(property, state, propertySet.getPropertyCSSV alue(property).get()); 1477 StyleBuilder::applyProperty(property, state, propertySet.getPropertyCSSV alue(property).get());
1459 } 1478 }
1460 } 1479 }
1461 1480
1462 void StyleResolver::addMediaQueryResults(const MediaQueryResultList& list) 1481 void StyleResolver::addMediaQueryResults(const MediaQueryResultList& list)
1463 { 1482 {
1464 for (size_t i = 0; i < list.size(); ++i) 1483 if (list.size())
1465 m_viewportDependentMediaQueryResults.append(list[i]); 1484 m_viewportDependentMediaQueryResults.appendVector(list);
1466 } 1485 }
1467 1486
1468 bool StyleResolver::mediaQueryAffectedByViewportChange() const 1487 bool StyleResolver::mediaQueryAffectedByViewportChange() const
1469 { 1488 {
1470 for (unsigned i = 0; i < m_viewportDependentMediaQueryResults.size(); ++i) { 1489 for (unsigned i = 0; i < m_viewportDependentMediaQueryResults.size(); ++i) {
1471 if (m_medium->eval(m_viewportDependentMediaQueryResults[i]->expression() ) != m_viewportDependentMediaQueryResults[i]->result()) 1490 if (m_medium->eval(m_viewportDependentMediaQueryResults[i]->expression() ) != m_viewportDependentMediaQueryResults[i]->result())
1472 return true; 1491 return true;
1473 } 1492 }
1474 return false; 1493 return false;
1475 } 1494 }
(...skipping 11 matching lines...) Expand all
1487 visitor->trace(m_watchedSelectorsRules); 1506 visitor->trace(m_watchedSelectorsRules);
1488 visitor->trace(m_treeBoundaryCrossingRules); 1507 visitor->trace(m_treeBoundaryCrossingRules);
1489 visitor->trace(m_styleResourceLoader); 1508 visitor->trace(m_styleResourceLoader);
1490 visitor->trace(m_styleSharingLists); 1509 visitor->trace(m_styleSharingLists);
1491 visitor->trace(m_pendingStyleSheets); 1510 visitor->trace(m_pendingStyleSheets);
1492 visitor->trace(m_document); 1511 visitor->trace(m_document);
1493 #endif 1512 #endif
1494 } 1513 }
1495 1514
1496 } // namespace blink 1515 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698