| 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 } | 80 } |
| 81 | 81 |
| 82 void didHitPresentationAttributeCache() | 82 void didHitPresentationAttributeCache() |
| 83 { | 83 { |
| 84 if (presentationAttributeCache().size() < minimumPresentationAttributeCa
cheSizeForCleaning) | 84 if (presentationAttributeCache().size() < minimumPresentationAttributeCa
cheSizeForCleaning) |
| 85 return; | 85 return; |
| 86 | 86 |
| 87 m_hitCount++; | 87 m_hitCount++; |
| 88 | 88 |
| 89 if (!m_cleanTimer.isActive()) | 89 if (!m_cleanTimer.isActive()) |
| 90 m_cleanTimer.startOneShot(presentationAttributeCacheCleanTimeInSecon
ds); | 90 m_cleanTimer.startOneShot(presentationAttributeCacheCleanTimeInSecon
ds, FROM_HERE); |
| 91 } | 91 } |
| 92 | 92 |
| 93 private: | 93 private: |
| 94 static const unsigned presentationAttributeCacheCleanTimeInSeconds = 60; | 94 static const unsigned presentationAttributeCacheCleanTimeInSeconds = 60; |
| 95 static const unsigned minimumPresentationAttributeCacheSizeForCleaning = 100
; | 95 static const unsigned minimumPresentationAttributeCacheSizeForCleaning = 100
; |
| 96 static const unsigned minimumPresentationAttributeCacheHitCountPerMinute = (
100 * presentationAttributeCacheCleanTimeInSeconds) / 60; | 96 static const unsigned minimumPresentationAttributeCacheHitCountPerMinute = (
100 * presentationAttributeCacheCleanTimeInSeconds) / 60; |
| 97 | 97 |
| 98 void cleanCache(Timer<PresentationAttributeCacheCleaner>* timer) | 98 void cleanCache(Timer<PresentationAttributeCacheCleaner>* timer) |
| 99 { | 99 { |
| 100 ASSERT_UNUSED(timer, timer == &m_cleanTimer); | 100 ASSERT_UNUSED(timer, timer == &m_cleanTimer); |
| (...skipping 98 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 WebCore | 208 } // namespace WebCore |
| OLD | NEW |