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

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

Issue 23049008: Replace style sharing cousin list search with LRU (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Updating to ToT Created 7 years, 4 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 | Annotate | Revision Log
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 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 void StyleResolver::collectFeatures() 235 void StyleResolver::collectFeatures()
236 { 236 {
237 m_features.clear(); 237 m_features.clear();
238 m_ruleSets.collectFeaturesTo(m_features, document()->isViewSource()); 238 m_ruleSets.collectFeaturesTo(m_features, document()->isViewSource());
239 m_styleTree.collectFeaturesTo(m_features); 239 m_styleTree.collectFeaturesTo(m_features);
240 240
241 m_siblingRuleSet = makeRuleSet(m_features.siblingRules); 241 m_siblingRuleSet = makeRuleSet(m_features.siblingRules);
242 m_uncommonAttributeRuleSet = makeRuleSet(m_features.uncommonAttributeRules); 242 m_uncommonAttributeRuleSet = makeRuleSet(m_features.uncommonAttributeRules);
243 } 243 }
244 244
245 void StyleResolver::addToStyleSharingList(Element* element)
246 {
247 if (m_styleSharingList.size() >= styleSharingListSize)
248 m_styleSharingList.remove(--m_styleSharingList.end());
249 m_styleSharingList.prepend(element);
250 }
251
252 void StyleResolver::clearStyleSharingList()
253 {
254 m_styleSharingList.clear();
255 }
256
245 void StyleResolver::pushParentElement(Element* parent) 257 void StyleResolver::pushParentElement(Element* parent)
246 { 258 {
247 const ContainerNode* parentsParent = parent->parentOrShadowHostElement(); 259 const ContainerNode* parentsParent = parent->parentOrShadowHostElement();
248 260
249 // We are not always invoked consistently. For example, script execution can cause us to enter 261 // We are not always invoked consistently. For example, script execution can cause us to enter
250 // style recalc in the middle of tree building. We may also be invoked from somewhere within the tree. 262 // style recalc in the middle of tree building. We may also be invoked from somewhere within the tree.
251 // Reset the stack in this case, or if we see a new root element. 263 // Reset the stack in this case, or if we see a new root element.
252 // Otherwise just push the new parent. 264 // Otherwise just push the new parent.
253 if (!parentsParent || m_selectorFilter.parentStackIsEmpty()) 265 if (!parentsParent || m_selectorFilter.parentStackIsEmpty())
254 m_selectorFilter.setupParentStack(parent); 266 m_selectorFilter.setupParentStack(parent);
(...skipping 1280 matching lines...) Expand 10 before | Expand all | Expand 10 after
1535 m_matchedPropertiesSearches, m_matchedPropertiesHit, m_matchedProperties SharedInheritedHit, m_matchedPropertiesToCache, m_matchedPropertiesEnteredIntoCa che); 1547 m_matchedPropertiesSearches, m_matchedPropertiesHit, m_matchedProperties SharedInheritedHit, m_matchedPropertiesToCache, m_matchedPropertiesEnteredIntoCa che);
1536 1548
1537 fprintf(stderr, "Total:\n"); 1549 fprintf(stderr, "Total:\n");
1538 printStyleStats(m_totalSearches, m_totalElementsEligibleForSharing, m_totalS tylesShared, m_totalSearchFoundSiblingForSharing, m_totalSearchesMissedSharing, 1550 printStyleStats(m_totalSearches, m_totalElementsEligibleForSharing, m_totalS tylesShared, m_totalSearchFoundSiblingForSharing, m_totalSearchesMissedSharing,
1539 m_totalMatchedPropertiesSearches, m_totalMatchedPropertiesHit, m_totalMa tchedPropertiesSharedInheritedHit, m_totalMatchedPropertiesToCache, m_totalMatch edPropertiesEnteredIntoCache); 1551 m_totalMatchedPropertiesSearches, m_totalMatchedPropertiesHit, m_totalMa tchedPropertiesSharedInheritedHit, m_totalMatchedPropertiesToCache, m_totalMatch edPropertiesEnteredIntoCache);
1540 fprintf(stderr, "----------------------------------------------------------- ---------------------\n"); 1552 fprintf(stderr, "----------------------------------------------------------- ---------------------\n");
1541 } 1553 }
1542 #endif 1554 #endif
1543 1555
1544 } // namespace WebCore 1556 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698