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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 | 47 |
48 class MatchedPropertiesCache { | 48 class MatchedPropertiesCache { |
49 WTF_MAKE_NONCOPYABLE(MatchedPropertiesCache); | 49 WTF_MAKE_NONCOPYABLE(MatchedPropertiesCache); |
50 public: | 50 public: |
51 MatchedPropertiesCache(); | 51 MatchedPropertiesCache(); |
52 | 52 |
53 const CachedMatchedProperties* find(unsigned hash, const StyleResolverState&
, const MatchResult&); | 53 const CachedMatchedProperties* find(unsigned hash, const StyleResolverState&
, const MatchResult&); |
54 void add(const RenderStyle*, const RenderStyle* parentStyle, unsigned hash,
const MatchResult&); | 54 void add(const RenderStyle*, const RenderStyle* parentStyle, unsigned hash,
const MatchResult&); |
55 | 55 |
56 void clear(); | 56 void clear(); |
| 57 void clearViewportDependent(); |
57 | 58 |
58 static bool isCacheable(const Element*, const RenderStyle*, const RenderStyl
e* parentStyle); | 59 static bool isCacheable(const Element*, const RenderStyle*, const RenderStyl
e* parentStyle); |
59 | 60 |
60 private: | 61 private: |
61 // Every N additions to the matched declaration cache trigger a sweep where
entries holding | 62 // Every N additions to the matched declaration cache trigger a sweep where
entries holding |
62 // the last reference to a style declaration are garbage collected. | 63 // the last reference to a style declaration are garbage collected. |
63 void sweep(Timer<MatchedPropertiesCache>*); | 64 void sweep(Timer<MatchedPropertiesCache>*); |
64 | 65 |
65 unsigned m_additionsSinceLastSweep; | 66 unsigned m_additionsSinceLastSweep; |
66 | 67 |
67 typedef HashMap<unsigned, OwnPtr<CachedMatchedProperties> > Cache; | 68 typedef HashMap<unsigned, OwnPtr<CachedMatchedProperties> > Cache; |
68 Cache m_cache; | 69 Cache m_cache; |
69 | 70 |
70 Timer<MatchedPropertiesCache> m_sweepTimer; | 71 Timer<MatchedPropertiesCache> m_sweepTimer; |
71 }; | 72 }; |
72 | 73 |
73 } | 74 } |
74 | 75 |
75 #endif | 76 #endif |
OLD | NEW |