OLD | NEW |
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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 DEFINE_INLINE_TRACE() { 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 | 57 |
58 template<typename VisitorDispatcher> | 58 template<typename VisitorDispatcher> |
59 static bool traceInCollection(VisitorDispatcher visitor, Member<CachedMatche
dProperties>& cachedProperties, WTF::ShouldWeakPointersBeMarkedStrongly strongif
y) | 59 static bool traceInCollection(VisitorDispatcher visitor, Member<CachedMatche
dProperties>& cachedProperties, WTF::ShouldWeakPointersBeMarkedStrongly strongif
y) |
60 { | 60 { |
61 // Only honor the cache's weakness semantics if the collection is traced | 61 // Only honor the cache's weakness semantics if the collection is traced |
62 // with WeakPointersActWeak. Otherwise just trace the cachedProperties | 62 // with WeakPointersActWeak. Otherwise just trace the cachedProperties |
63 // strongly, ie. call trace on it. | 63 // strongly, ie. call trace on it. |
64 if (cachedProperties && strongify == WTF::WeakPointersActWeak) { | 64 if (cachedProperties && strongify == WTF::WeakPointersActWeak) { |
65 // A given cache entry is only kept alive if none of the MatchedProp
erties | 65 // A given cache entry is only kept alive if none of the MatchedProp
erties |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 private: | 104 private: |
105 #if ENABLE(OILPAN) | 105 #if ENABLE(OILPAN) |
106 typedef HeapHashMap<unsigned, Member<CachedMatchedProperties>, DefaultHash<u
nsigned>::Hash, HashTraits<unsigned>, CachedMatchedPropertiesHashTraits > Cache; | 106 typedef HeapHashMap<unsigned, Member<CachedMatchedProperties>, DefaultHash<u
nsigned>::Hash, HashTraits<unsigned>, CachedMatchedPropertiesHashTraits > Cache; |
107 #else | 107 #else |
108 // Every N additions to the matched declaration cache trigger a sweep where
entries holding | 108 // Every N additions to the matched declaration cache trigger a sweep where
entries holding |
109 // the last reference to a style declaration are garbage collected. | 109 // the last reference to a style declaration are garbage collected. |
110 void sweep(Timer<MatchedPropertiesCache>*); | 110 void sweep(Timer<MatchedPropertiesCache>*); |
111 | 111 |
112 unsigned m_additionsSinceLastSweep; | 112 unsigned m_additionsSinceLastSweep; |
113 | 113 |
114 typedef HashMap<unsigned, OwnPtr<CachedMatchedProperties> > Cache; | 114 typedef HashMap<unsigned, OwnPtr<CachedMatchedProperties>> Cache; |
115 Timer<MatchedPropertiesCache> m_sweepTimer; | 115 Timer<MatchedPropertiesCache> m_sweepTimer; |
116 #endif | 116 #endif |
117 Cache m_cache; | 117 Cache m_cache; |
118 }; | 118 }; |
119 | 119 |
120 } | 120 } |
121 | 121 |
122 #endif | 122 #endif |
OLD | NEW |