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

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, 3 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
« no previous file with comments | « Source/core/css/resolver/StyleResolver.h ('k') | Source/core/dom/ContainerNode.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 void StyleResolver::collectFeatures() 236 void StyleResolver::collectFeatures()
237 { 237 {
238 m_features.clear(); 238 m_features.clear();
239 m_ruleSets.collectFeaturesTo(m_features, document().isViewSource()); 239 m_ruleSets.collectFeaturesTo(m_features, document().isViewSource());
240 m_styleTree.collectFeaturesTo(m_features); 240 m_styleTree.collectFeaturesTo(m_features);
241 241
242 m_siblingRuleSet = makeRuleSet(m_features.siblingRules); 242 m_siblingRuleSet = makeRuleSet(m_features.siblingRules);
243 m_uncommonAttributeRuleSet = makeRuleSet(m_features.uncommonAttributeRules); 243 m_uncommonAttributeRuleSet = makeRuleSet(m_features.uncommonAttributeRules);
244 } 244 }
245 245
246 void StyleResolver::addToStyleSharingList(Element* element)
247 {
248 if (m_styleSharingList.size() >= styleSharingListSize)
249 m_styleSharingList.remove(--m_styleSharingList.end());
250 m_styleSharingList.prepend(element);
251 }
252
253 void StyleResolver::clearStyleSharingList()
254 {
255 m_styleSharingList.clear();
256 }
257
246 void StyleResolver::pushParentElement(Element* parent) 258 void StyleResolver::pushParentElement(Element* parent)
247 { 259 {
248 ASSERT(parent); 260 ASSERT(parent);
249 const ContainerNode* parentsParent = parent->parentOrShadowHostElement(); 261 const ContainerNode* parentsParent = parent->parentOrShadowHostElement();
250 262
251 // We are not always invoked consistently. For example, script execution can cause us to enter 263 // We are not always invoked consistently. For example, script execution can cause us to enter
252 // style recalc in the middle of tree building. We may also be invoked from somewhere within the tree. 264 // style recalc in the middle of tree building. We may also be invoked from somewhere within the tree.
253 // Reset the stack in this case, or if we see a new root element. 265 // Reset the stack in this case, or if we see a new root element.
254 // Otherwise just push the new parent. 266 // Otherwise just push the new parent.
255 if (!parentsParent || m_selectorFilter.parentStackIsEmpty()) 267 if (!parentsParent || m_selectorFilter.parentStackIsEmpty())
(...skipping 1257 matching lines...) Expand 10 before | Expand all | Expand 10 after
1513 m_matchedPropertiesSearches, m_matchedPropertiesHit, m_matchedProperties SharedInheritedHit, m_matchedPropertiesToCache, m_matchedPropertiesEnteredIntoCa che); 1525 m_matchedPropertiesSearches, m_matchedPropertiesHit, m_matchedProperties SharedInheritedHit, m_matchedPropertiesToCache, m_matchedPropertiesEnteredIntoCa che);
1514 1526
1515 fprintf(stderr, "Total:\n"); 1527 fprintf(stderr, "Total:\n");
1516 printStyleStats(m_totalSearches, m_totalElementsEligibleForSharing, m_totalS tylesShared, m_totalSearchFoundSiblingForSharing, m_totalSearchesMissedSharing, 1528 printStyleStats(m_totalSearches, m_totalElementsEligibleForSharing, m_totalS tylesShared, m_totalSearchFoundSiblingForSharing, m_totalSearchesMissedSharing,
1517 m_totalMatchedPropertiesSearches, m_totalMatchedPropertiesHit, m_totalMa tchedPropertiesSharedInheritedHit, m_totalMatchedPropertiesToCache, m_totalMatch edPropertiesEnteredIntoCache); 1529 m_totalMatchedPropertiesSearches, m_totalMatchedPropertiesHit, m_totalMa tchedPropertiesSharedInheritedHit, m_totalMatchedPropertiesToCache, m_totalMatch edPropertiesEnteredIntoCache);
1518 fprintf(stderr, "----------------------------------------------------------- ---------------------\n"); 1530 fprintf(stderr, "----------------------------------------------------------- ---------------------\n");
1519 } 1531 }
1520 #endif 1532 #endif
1521 1533
1522 } // namespace WebCore 1534 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/css/resolver/StyleResolver.h ('k') | Source/core/dom/ContainerNode.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698