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

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

Issue 138643003: Simpler return value of HashTable::add/HashMap:add and others (Closed)
Patch Set: Daily master update (now with base url?) Created 6 years, 10 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
« no previous file with comments | « Source/core/css/StyleSheetContents.cpp ('k') | Source/core/css/resolver/ScopedStyleTree.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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 static const unsigned maxAdditionsBetweenSweeps = 100; 88 static const unsigned maxAdditionsBetweenSweeps = 100;
89 if (++m_additionsSinceLastSweep >= maxAdditionsBetweenSweeps 89 if (++m_additionsSinceLastSweep >= maxAdditionsBetweenSweeps
90 && !m_sweepTimer.isActive()) { 90 && !m_sweepTimer.isActive()) {
91 static const unsigned sweepTimeInSeconds = 60; 91 static const unsigned sweepTimeInSeconds = 60;
92 m_sweepTimer.startOneShot(sweepTimeInSeconds); 92 m_sweepTimer.startOneShot(sweepTimeInSeconds);
93 } 93 }
94 94
95 ASSERT(hash); 95 ASSERT(hash);
96 Cache::AddResult addResult = m_cache.add(hash, nullptr); 96 Cache::AddResult addResult = m_cache.add(hash, nullptr);
97 if (addResult.isNewEntry) 97 if (addResult.isNewEntry)
98 addResult.iterator->value = adoptPtr(new CachedMatchedProperties); 98 addResult.storedValue->value = adoptPtr(new CachedMatchedProperties);
99 99
100 CachedMatchedProperties* cacheItem = addResult.iterator->value.get(); 100 CachedMatchedProperties* cacheItem = addResult.storedValue->value.get();
101 if (!addResult.isNewEntry) 101 if (!addResult.isNewEntry)
102 cacheItem->clear(); 102 cacheItem->clear();
103 103
104 cacheItem->set(style, parentStyle, matchResult); 104 cacheItem->set(style, parentStyle, matchResult);
105 } 105 }
106 106
107 void MatchedPropertiesCache::clear() 107 void MatchedPropertiesCache::clear()
108 { 108 {
109 m_cache.clear(); 109 m_cache.clear();
110 } 110 }
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 // CSSPropertyInternalCallback sets the rule's selector name into the Render Style, and that's not recalculated if the RenderStyle is loaded from the cache, so don't cache it. 163 // CSSPropertyInternalCallback sets the rule's selector name into the Render Style, and that's not recalculated if the RenderStyle is loaded from the cache, so don't cache it.
164 if (!style->callbackSelectors().isEmpty()) 164 if (!style->callbackSelectors().isEmpty())
165 return false; 165 return false;
166 // The cache assumes static knowledge about which properties are inherited. 166 // The cache assumes static knowledge about which properties are inherited.
167 if (parentStyle->hasExplicitlyInheritedProperties()) 167 if (parentStyle->hasExplicitlyInheritedProperties())
168 return false; 168 return false;
169 return true; 169 return true;
170 } 170 }
171 171
172 } 172 }
OLDNEW
« no previous file with comments | « Source/core/css/StyleSheetContents.cpp ('k') | Source/core/css/resolver/ScopedStyleTree.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698