OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 BLINK_FROM_HERE); | 97 BLINK_FROM_HERE); |
98 } | 98 } |
99 | 99 |
100 private: | 100 private: |
101 static const unsigned presentationAttributeCacheCleanTimeInSeconds = 60; | 101 static const unsigned presentationAttributeCacheCleanTimeInSeconds = 60; |
102 static const unsigned minimumPresentationAttributeCacheSizeForCleaning = 100; | 102 static const unsigned minimumPresentationAttributeCacheSizeForCleaning = 100; |
103 static const unsigned minimumPresentationAttributeCacheHitCountPerMinute = | 103 static const unsigned minimumPresentationAttributeCacheHitCountPerMinute = |
104 (100 * presentationAttributeCacheCleanTimeInSeconds) / 60; | 104 (100 * presentationAttributeCacheCleanTimeInSeconds) / 60; |
105 | 105 |
106 void cleanCache(TimerBase* timer) { | 106 void cleanCache(TimerBase* timer) { |
107 ASSERT_UNUSED(timer, timer == &m_cleanTimer); | 107 DCHECK_EQ(timer, &m_cleanTimer); |
108 unsigned hitCount = m_hitCount; | 108 unsigned hitCount = m_hitCount; |
109 m_hitCount = 0; | 109 m_hitCount = 0; |
110 if (hitCount > minimumPresentationAttributeCacheHitCountPerMinute) | 110 if (hitCount > minimumPresentationAttributeCacheHitCountPerMinute) |
111 return; | 111 return; |
112 presentationAttributeCache().clear(); | 112 presentationAttributeCache().clear(); |
113 } | 113 } |
114 | 114 |
115 unsigned m_hitCount; | 115 unsigned m_hitCount; |
116 Timer<PresentationAttributeCacheCleaner> m_cleanTimer; | 116 Timer<PresentationAttributeCacheCleaner> m_cleanTimer; |
117 }; | 117 }; |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 presentationAttributeCache().clear(); | 215 presentationAttributeCache().clear(); |
216 presentationAttributeCache().set(cacheHash, newEntry); | 216 presentationAttributeCache().set(cacheHash, newEntry); |
217 } else { | 217 } else { |
218 cacheValue->value = newEntry; | 218 cacheValue->value = newEntry; |
219 } | 219 } |
220 | 220 |
221 return style; | 221 return style; |
222 } | 222 } |
223 | 223 |
224 } // namespace blink | 224 } // namespace blink |
OLD | NEW |