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

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

Issue 953693002: InlinedVisitor: Migrate css to use inlined tracing (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 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 | 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 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 3 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
4 * Copyright (C) 2013 Google Inc. All rights reserved. 4 * Copyright (C) 2013 Google Inc. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 28 matching lines...) Expand all
39 class CachedMatchedProperties final : public NoBaseWillBeGarbageCollectedFinaliz ed<CachedMatchedProperties> { 39 class CachedMatchedProperties final : public NoBaseWillBeGarbageCollectedFinaliz ed<CachedMatchedProperties> {
40 40
41 public: 41 public:
42 WillBeHeapVector<MatchedProperties> matchedProperties; 42 WillBeHeapVector<MatchedProperties> matchedProperties;
43 MatchRanges ranges; 43 MatchRanges ranges;
44 RefPtr<LayoutStyle> layoutStyle; 44 RefPtr<LayoutStyle> layoutStyle;
45 RefPtr<LayoutStyle> parentLayoutStyle; 45 RefPtr<LayoutStyle> parentLayoutStyle;
46 46
47 void set(const LayoutStyle&, const LayoutStyle& parentStyle, const MatchResu lt&); 47 void set(const LayoutStyle&, const LayoutStyle& parentStyle, const MatchResu lt&);
48 void clear(); 48 void clear();
49 void trace(Visitor* visitor) { visitor->trace(matchedProperties); } 49 DEFINE_INLINE_TRACE() { visitor->trace(matchedProperties); }
50 }; 50 };
51 51
52 // Specialize the HashTraits for CachedMatchedProperties to check for dead 52 // Specialize the HashTraits for CachedMatchedProperties to check for dead
53 // entries in the MatchedPropertiesCache. 53 // entries in the MatchedPropertiesCache.
54 #if ENABLE(OILPAN) 54 #if ENABLE(OILPAN)
55 struct CachedMatchedPropertiesHashTraits : HashTraits<Member<CachedMatchedProper ties> > { 55 struct CachedMatchedPropertiesHashTraits : HashTraits<Member<CachedMatchedProper ties> > {
56 static const WTF::WeakHandlingFlag weakHandlingFlag = WTF::WeakHandlingInCol lections; 56 static const WTF::WeakHandlingFlag weakHandlingFlag = WTF::WeakHandlingInCol lections;
57 static bool traceInCollection(Visitor*, Member<CachedMatchedProperties>&, WT F::ShouldWeakPointersBeMarkedStrongly); 57 static bool traceInCollection(Visitor*, Member<CachedMatchedProperties>&, WT F::ShouldWeakPointersBeMarkedStrongly);
58 }; 58 };
59 #endif 59 #endif
60 60
61 class MatchedPropertiesCache { 61 class MatchedPropertiesCache {
62 DISALLOW_ALLOCATION(); 62 DISALLOW_ALLOCATION();
63 WTF_MAKE_NONCOPYABLE(MatchedPropertiesCache); 63 WTF_MAKE_NONCOPYABLE(MatchedPropertiesCache);
64 public: 64 public:
65 MatchedPropertiesCache(); 65 MatchedPropertiesCache();
66 66
67 const CachedMatchedProperties* find(unsigned hash, const StyleResolverState& , const MatchResult&); 67 const CachedMatchedProperties* find(unsigned hash, const StyleResolverState& , const MatchResult&);
68 void add(const LayoutStyle&, const LayoutStyle& parentStyle, unsigned hash, const MatchResult&); 68 void add(const LayoutStyle&, const LayoutStyle& parentStyle, unsigned hash, const MatchResult&);
69 69
70 void clear(); 70 void clear();
71 void clearViewportDependent(); 71 void clearViewportDependent();
72 72
73 static bool isCacheable(const Element*, const LayoutStyle&, const LayoutStyl e& parentStyle); 73 static bool isCacheable(const Element*, const LayoutStyle&, const LayoutStyl e& parentStyle);
74 74
75 void trace(Visitor*); 75 DECLARE_TRACE();
76 76
77 private: 77 private:
78 #if ENABLE(OILPAN) 78 #if ENABLE(OILPAN)
79 typedef HeapHashMap<unsigned, Member<CachedMatchedProperties>, DefaultHash<u nsigned>::Hash, HashTraits<unsigned>, CachedMatchedPropertiesHashTraits > Cache; 79 typedef HeapHashMap<unsigned, Member<CachedMatchedProperties>, DefaultHash<u nsigned>::Hash, HashTraits<unsigned>, CachedMatchedPropertiesHashTraits > Cache;
80 #else 80 #else
81 // Every N additions to the matched declaration cache trigger a sweep where entries holding 81 // Every N additions to the matched declaration cache trigger a sweep where entries holding
82 // the last reference to a style declaration are garbage collected. 82 // the last reference to a style declaration are garbage collected.
83 void sweep(Timer<MatchedPropertiesCache>*); 83 void sweep(Timer<MatchedPropertiesCache>*);
84 84
85 unsigned m_additionsSinceLastSweep; 85 unsigned m_additionsSinceLastSweep;
86 86
87 typedef HashMap<unsigned, OwnPtr<CachedMatchedProperties> > Cache; 87 typedef HashMap<unsigned, OwnPtr<CachedMatchedProperties> > Cache;
88 Timer<MatchedPropertiesCache> m_sweepTimer; 88 Timer<MatchedPropertiesCache> m_sweepTimer;
89 #endif 89 #endif
90 Cache m_cache; 90 Cache m_cache;
91 }; 91 };
92 92
93 } 93 }
94 94
95 #endif 95 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698