Chromium Code Reviews| Index: Source/core/css/resolver/MatchedPropertiesCache.h |
| diff --git a/Source/core/css/resolver/MatchedPropertiesCache.h b/Source/core/css/resolver/MatchedPropertiesCache.h |
| index d86bf01f856cfc35b29ce941a2c0e18c80581dd8..048f778ae5cd6a16ccf8bfb66ed262b6b615f5cf 100644 |
| --- a/Source/core/css/resolver/MatchedPropertiesCache.h |
| +++ b/Source/core/css/resolver/MatchedPropertiesCache.h |
| @@ -26,6 +26,7 @@ |
| #include "core/css/resolver/MatchResult.h" |
| #include "platform/Timer.h" |
| +#include "platform/heap/Handle.h" |
| #include "wtf/Forward.h" |
| #include "wtf/HashMap.h" |
| #include "wtf/Noncopyable.h" |
| @@ -35,17 +36,21 @@ namespace WebCore { |
| class RenderStyle; |
| class StyleResolverState; |
| -struct CachedMatchedProperties { |
| - Vector<MatchedProperties> matchedProperties; |
| +struct CachedMatchedProperties : public NoBaseWillBeGarbageCollectedFinalized<CachedMatchedProperties> { |
|
haraken
2014/05/08 11:43:45
Nit: struct => class
wibling-chromium
2014/05/08 12:38:55
Done.
|
| + |
| +public: |
| + WillBeHeapVector<MatchedProperties> matchedProperties; |
| MatchRanges ranges; |
| RefPtr<RenderStyle> renderStyle; |
| RefPtr<RenderStyle> parentRenderStyle; |
| void set(const RenderStyle*, const RenderStyle* parentStyle, const MatchResult&); |
| void clear(); |
| + void trace(Visitor* visitor) { visitor->trace(matchedProperties); } |
| }; |
| class MatchedPropertiesCache { |
| + DISALLOW_ALLOCATION(); |
| WTF_MAKE_NONCOPYABLE(MatchedPropertiesCache); |
| public: |
| MatchedPropertiesCache(); |
| @@ -58,6 +63,9 @@ public: |
| static bool isCacheable(const Element*, const RenderStyle*, const RenderStyle* parentStyle); |
| + void trace(Visitor*); |
| + void processWeakMembers(Visitor*); |
| + |
| private: |
| // Every N additions to the matched declaration cache trigger a sweep where entries holding |
| // the last reference to a style declaration are garbage collected. |
| @@ -65,10 +73,13 @@ private: |
| unsigned m_additionsSinceLastSweep; |
| - typedef HashMap<unsigned, OwnPtr<CachedMatchedProperties> > Cache; |
| + typedef WillBeHeapHashMap<unsigned, OwnPtrWillBeMember<CachedMatchedProperties> > Cache; |
| Cache m_cache; |
| - |
| Timer<MatchedPropertiesCache> m_sweepTimer; |
| + |
| +#if ENABLE(OILPAN) |
| + bool m_cacheNeedsCleaning; |
| +#endif |
| }; |
| } |