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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 } | 83 } |
84 | 84 |
85 void didHitPresentationAttributeCache() | 85 void didHitPresentationAttributeCache() |
86 { | 86 { |
87 if (presentationAttributeCache().size() < minimumPresentationAttributeCa
cheSizeForCleaning) | 87 if (presentationAttributeCache().size() < minimumPresentationAttributeCa
cheSizeForCleaning) |
88 return; | 88 return; |
89 | 89 |
90 m_hitCount++; | 90 m_hitCount++; |
91 | 91 |
92 if (!m_cleanTimer.isActive()) | 92 if (!m_cleanTimer.isActive()) |
93 m_cleanTimer.startOneShot(presentationAttributeCacheCleanTimeInSecon
ds, FROM_HERE); | 93 m_cleanTimer.startOneShot(presentationAttributeCacheCleanTimeInSecon
ds, BLINK_FROM_HERE); |
94 } | 94 } |
95 | 95 |
96 private: | 96 private: |
97 static const unsigned presentationAttributeCacheCleanTimeInSeconds = 60; | 97 static const unsigned presentationAttributeCacheCleanTimeInSeconds = 60; |
98 static const unsigned minimumPresentationAttributeCacheSizeForCleaning = 100
; | 98 static const unsigned minimumPresentationAttributeCacheSizeForCleaning = 100
; |
99 static const unsigned minimumPresentationAttributeCacheHitCountPerMinute = (
100 * presentationAttributeCacheCleanTimeInSeconds) / 60; | 99 static const unsigned minimumPresentationAttributeCacheHitCountPerMinute = (
100 * presentationAttributeCacheCleanTimeInSeconds) / 60; |
100 | 100 |
101 void cleanCache(Timer<PresentationAttributeCacheCleaner>* timer) | 101 void cleanCache(Timer<PresentationAttributeCacheCleaner>* timer) |
102 { | 102 { |
103 ASSERT_UNUSED(timer, timer == &m_cleanTimer); | 103 ASSERT_UNUSED(timer, timer == &m_cleanTimer); |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 presentationAttributeCache().clear(); | 199 presentationAttributeCache().clear(); |
200 presentationAttributeCache().set(cacheHash, newEntry.release()); | 200 presentationAttributeCache().set(cacheHash, newEntry.release()); |
201 } else { | 201 } else { |
202 cacheValue->value = newEntry.release(); | 202 cacheValue->value = newEntry.release(); |
203 } | 203 } |
204 | 204 |
205 return style.release(); | 205 return style.release(); |
206 } | 206 } |
207 | 207 |
208 } // namespace blink | 208 } // namespace blink |
OLD | NEW |