| 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 28 matching lines...) Expand all Loading... |
| 39 class CachedMatchedProperties final { | 39 class CachedMatchedProperties final { |
| 40 | 40 |
| 41 public: | 41 public: |
| 42 Vector<MatchedProperties> matchedProperties; | 42 Vector<MatchedProperties> matchedProperties; |
| 43 MatchRanges ranges; | 43 MatchRanges ranges; |
| 44 RefPtr<RenderStyle> renderStyle; | 44 RefPtr<RenderStyle> renderStyle; |
| 45 RefPtr<RenderStyle> parentRenderStyle; | 45 RefPtr<RenderStyle> parentRenderStyle; |
| 46 | 46 |
| 47 void set(const RenderStyle*, const RenderStyle* parentStyle, const MatchResu
lt&); | 47 void set(const RenderStyle*, const RenderStyle* parentStyle, const MatchResu
lt&); |
| 48 void clear(); | 48 void clear(); |
| 49 void trace(Visitor* visitor) { visitor->trace(matchedProperties); } | |
| 50 }; | 49 }; |
| 51 | 50 |
| 52 class MatchedPropertiesCache { | 51 class MatchedPropertiesCache { |
| 53 DISALLOW_ALLOCATION(); | 52 DISALLOW_ALLOCATION(); |
| 54 WTF_MAKE_NONCOPYABLE(MatchedPropertiesCache); | 53 WTF_MAKE_NONCOPYABLE(MatchedPropertiesCache); |
| 55 public: | 54 public: |
| 56 MatchedPropertiesCache(); | 55 MatchedPropertiesCache(); |
| 57 | 56 |
| 58 const CachedMatchedProperties* find(unsigned hash, const StyleResolverState&
, const MatchResult&); | 57 const CachedMatchedProperties* find(unsigned hash, const StyleResolverState&
, const MatchResult&); |
| 59 void add(const RenderStyle*, const RenderStyle* parentStyle, unsigned hash,
const MatchResult&); | 58 void add(const RenderStyle*, const RenderStyle* parentStyle, unsigned hash,
const MatchResult&); |
| 60 | 59 |
| 61 void clear(); | 60 void clear(); |
| 62 void clearViewportDependent(); | 61 void clearViewportDependent(); |
| 63 | 62 |
| 64 static bool isCacheable(const Element*, const RenderStyle*, const RenderStyl
e* parentStyle); | 63 static bool isCacheable(const Element*, const RenderStyle*, const RenderStyl
e* parentStyle); |
| 65 | 64 |
| 66 void trace(Visitor*); | |
| 67 | |
| 68 private: | 65 private: |
| 69 // Every N additions to the matched declaration cache trigger a sweep where
entries holding | 66 // Every N additions to the matched declaration cache trigger a sweep where
entries holding |
| 70 // the last reference to a style declaration are garbage collected. | 67 // the last reference to a style declaration are garbage collected. |
| 71 void sweep(Timer<MatchedPropertiesCache>*); | 68 void sweep(Timer<MatchedPropertiesCache>*); |
| 72 | 69 |
| 73 unsigned m_additionsSinceLastSweep; | 70 unsigned m_additionsSinceLastSweep; |
| 74 | 71 |
| 75 typedef HashMap<unsigned, OwnPtr<CachedMatchedProperties> > Cache; | 72 typedef HashMap<unsigned, OwnPtr<CachedMatchedProperties> > Cache; |
| 76 Timer<MatchedPropertiesCache> m_sweepTimer; | 73 Timer<MatchedPropertiesCache> m_sweepTimer; |
| 77 Cache m_cache; | 74 Cache m_cache; |
| 78 }; | 75 }; |
| 79 | 76 |
| 80 } | 77 } |
| 81 | 78 |
| 82 #endif | 79 #endif |
| OLD | NEW |