Changeset 131388 in webkit
- Timestamp:
- Oct 15, 2012 5:36:39 PM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r131387 r131388 1 2012-10-15 Andreas Kling <kling@webkit.org> 2 3 StyleResolver: Garbage collect the matched properties cache on a timer. 4 <http://webkit.org/b/98625> 5 6 Reviewed by Eric Seidel. 7 8 Sweeping the matched properties cache once every 100 additions ended up choking RoboHornet's 9 svgresize.html benchmark. Move it to a single-shot timer that's refreshed every 100 additions 10 and defers the actual sweep for 60 seconds. 11 12 * css/StyleResolver.cpp: 13 (WebCore::StyleResolver::StyleResolver): 14 (WebCore::StyleResolver::sweepMatchedPropertiesCache): 15 (WebCore::StyleResolver::addToMatchedPropertiesCache): 16 * css/StyleResolver.h: 17 (StyleResolver): 18 1 19 2012-10-15 Arnaud Renevier <a.renevier@sisa.samsung.com> 2 20 -
trunk/Source/WebCore/css/StyleResolver.cpp
r131357 r131388 265 265 , m_backgroundData(BackgroundFillLayer) 266 266 , m_matchedPropertiesCacheAdditionsSinceLastSweep(0) 267 , m_matchedPropertiesCacheSweepTimer(this, &StyleResolver::sweepMatchedPropertiesCache) 267 268 , m_checker(document, !document->inQuirksMode()) 268 269 , m_parentStyle(0) … … 491 492 } 492 493 493 void StyleResolver::sweepMatchedPropertiesCache( )494 void StyleResolver::sweepMatchedPropertiesCache(Timer<StyleResolver>*) 494 495 { 495 496 // Look for cache entries containing a style declaration with a single ref and remove them. 496 // This may happen when an element attribute mutation causes it to swap out its Attribute::decl()497 // for another CSSMappedAttributeDeclaration, potentially leaving this cache with the last ref.497 // This may happen when an element attribute mutation causes it to generate a new attributeStyle(), 498 // potentially leaving this cache with the last ref on the old one. 498 499 Vector<unsigned, 16> toRemove; 499 500 MatchedPropertiesCache::iterator it = m_matchedPropertiesCache.begin(); … … 510 511 for (size_t i = 0; i < toRemove.size(); ++i) 511 512 m_matchedPropertiesCache.remove(toRemove[i]); 513 514 m_matchedPropertiesCacheAdditionsSinceLastSweep = 0; 512 515 } 513 516 … … 2378 2381 void StyleResolver::addToMatchedPropertiesCache(const RenderStyle* style, const RenderStyle* parentStyle, unsigned hash, const MatchResult& matchResult) 2379 2382 { 2380 static unsigned matchedDeclarationCacheAdditionsBetweenSweeps = 100;2383 static const unsigned matchedDeclarationCacheAdditionsBetweenSweeps = 100; 2381 2384 if (++m_matchedPropertiesCacheAdditionsSinceLastSweep >= matchedDeclarationCacheAdditionsBetweenSweeps) { 2382 s weepMatchedPropertiesCache();2383 m_matchedPropertiesCache AdditionsSinceLastSweep = 0;2385 static const unsigned matchedDeclarationCacheSweepTimeInSeconds = 60; 2386 m_matchedPropertiesCacheSweepTimer.startOneShot(matchedDeclarationCacheSweepTimeInSeconds); 2384 2387 } 2385 2388 -
trunk/Source/WebCore/css/StyleResolver.h
r131047 r131388 430 430 // Every N additions to the matched declaration cache trigger a sweep where entries holding 431 431 // the last reference to a style declaration are garbage collected. 432 void sweepMatchedPropertiesCache( );432 void sweepMatchedPropertiesCache(Timer<StyleResolver>*); 433 433 434 434 unsigned m_matchedPropertiesCacheAdditionsSinceLastSweep; … … 436 436 typedef HashMap<unsigned, MatchedPropertiesCacheItem> MatchedPropertiesCache; 437 437 MatchedPropertiesCache m_matchedPropertiesCache; 438 439 Timer<StyleResolver> m_matchedPropertiesCacheSweepTimer; 438 440 439 441 // A buffer used to hold the set of matched rules for an element, and a temporary buffer used for
Note: See TracChangeset
for help on using the changeset viewer.