| 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 | 90 |
| 91 if (!m_cleanTimer.isActive()) | 91 if (!m_cleanTimer.isActive()) |
| 92 m_cleanTimer.startOneShot(presentationAttributeCacheCleanTimeInSecon
ds, BLINK_FROM_HERE); | 92 m_cleanTimer.startOneShot(presentationAttributeCacheCleanTimeInSecon
ds, BLINK_FROM_HERE); |
| 93 } | 93 } |
| 94 | 94 |
| 95 private: | 95 private: |
| 96 static const unsigned presentationAttributeCacheCleanTimeInSeconds = 60; | 96 static const unsigned presentationAttributeCacheCleanTimeInSeconds = 60; |
| 97 static const unsigned minimumPresentationAttributeCacheSizeForCleaning = 100
; | 97 static const unsigned minimumPresentationAttributeCacheSizeForCleaning = 100
; |
| 98 static const unsigned minimumPresentationAttributeCacheHitCountPerMinute = (
100 * presentationAttributeCacheCleanTimeInSeconds) / 60; | 98 static const unsigned minimumPresentationAttributeCacheHitCountPerMinute = (
100 * presentationAttributeCacheCleanTimeInSeconds) / 60; |
| 99 | 99 |
| 100 void cleanCache(Timer<PresentationAttributeCacheCleaner>* timer) | 100 void cleanCache(TimerBase* timer) |
| 101 { | 101 { |
| 102 ASSERT_UNUSED(timer, timer == &m_cleanTimer); | 102 ASSERT_UNUSED(timer, timer == &m_cleanTimer); |
| 103 unsigned hitCount = m_hitCount; | 103 unsigned hitCount = m_hitCount; |
| 104 m_hitCount = 0; | 104 m_hitCount = 0; |
| 105 if (hitCount > minimumPresentationAttributeCacheHitCountPerMinute) | 105 if (hitCount > minimumPresentationAttributeCacheHitCountPerMinute) |
| 106 return; | 106 return; |
| 107 presentationAttributeCache().clear(); | 107 presentationAttributeCache().clear(); |
| 108 } | 108 } |
| 109 | 109 |
| 110 unsigned m_hitCount; | 110 unsigned m_hitCount; |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 presentationAttributeCache().clear(); | 198 presentationAttributeCache().clear(); |
| 199 presentationAttributeCache().set(cacheHash, newEntry); | 199 presentationAttributeCache().set(cacheHash, newEntry); |
| 200 } else { | 200 } else { |
| 201 cacheValue->value = newEntry; | 201 cacheValue->value = newEntry; |
| 202 } | 202 } |
| 203 | 203 |
| 204 return style; | 204 return style; |
| 205 } | 205 } |
| 206 | 206 |
| 207 } // namespace blink | 207 } // namespace blink |
| OLD | NEW |