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

Unified Diff: third_party/WebKit/Source/core/dom/PresentationAttributeStyle.cpp

Issue 2647703006: Move PresentationAttributeCacheCleaner timer to main thread's timer task runner. (Closed)
Patch Set: add a comment Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/dom/PresentationAttributeStyle.cpp
diff --git a/third_party/WebKit/Source/core/dom/PresentationAttributeStyle.cpp b/third_party/WebKit/Source/core/dom/PresentationAttributeStyle.cpp
index ab70f6598b9e000089e4166b3922f10296254bf4..e014e49f24f243ffc15f43e555d462b530337018 100644
--- a/third_party/WebKit/Source/core/dom/PresentationAttributeStyle.cpp
+++ b/third_party/WebKit/Source/core/dom/PresentationAttributeStyle.cpp
@@ -35,6 +35,9 @@
#include "core/dom/Element.h"
#include "core/html/HTMLInputElement.h"
#include "platform/Timer.h"
+#include "public/platform/Platform.h"
+#include "public/platform/WebScheduler.h"
+#include "public/platform/WebThread.h"
#include "wtf/HashFunctions.h"
#include "wtf/HashMap.h"
#include "wtf/text/CString.h"
@@ -76,6 +79,9 @@ static PresentationAttributeCache& presentationAttributeCache() {
return cache;
}
+// This is a singleton (held via DEFINE_STATIC_LOCAL).
+// Thus it is appropriate to use the main thread's timer task runner, rather
+// than one associated with a particular frame.
class PresentationAttributeCacheCleaner {
WTF_MAKE_NONCOPYABLE(PresentationAttributeCacheCleaner);
USING_FAST_MALLOC(PresentationAttributeCacheCleaner);
@@ -83,7 +89,10 @@ class PresentationAttributeCacheCleaner {
public:
PresentationAttributeCacheCleaner()
: m_hitCount(0),
- m_cleanTimer(this, &PresentationAttributeCacheCleaner::cleanCache) {}
+ m_cleanTimer(
+ Platform::current()->mainThread()->scheduler()->timerTaskRunner(),
+ this,
+ &PresentationAttributeCacheCleaner::cleanCache) {}
void didHitPresentationAttributeCache() {
if (presentationAttributeCache().size() <
@@ -113,7 +122,7 @@ class PresentationAttributeCacheCleaner {
}
unsigned m_hitCount;
- Timer<PresentationAttributeCacheCleaner> m_cleanTimer;
+ TaskRunnerTimer<PresentationAttributeCacheCleaner> m_cleanTimer;
};
static bool attributeNameSort(const std::pair<StringImpl*, AtomicString>& p1,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698