Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(216)

Side by Side Diff: third_party/WebKit/Source/core/dom/PresentationAttributeStyle.cpp

Issue 2191533003: Refactor Timer classes in preparation for landing FrameTimers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More build fixes Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/MainThreadTaskRunner.cpp ('k') | third_party/WebKit/Source/core/editing/FrameCaret.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698