Reviewers: haraken
CL:
https://codereview.chromium.org/2647703006/Message:
There's only one of these (held by DEFINE_STATIC_LOCAL). Continuing to use the
thread's timer task runner seems reasonable.
Description:
Move PresentationAttributeCacheCleaner timer to main thread's timer task runner.
This is shared by multiple frames in the renderer main thread. Conceptually
it's UnspecedTimer, but since it's not associated with any particular frame,
and we know it will be used on the main thread, we can just use the main
thread's timer task queue.
BUG=624694
Affected files (+8, -2 lines):
M third_party/WebKit/Source/core/dom/PresentationAttributeStyle.cpp
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..f52a269f32ebb46301af2137d28fbf0f509c16cb 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"
@@ -83,7 +86,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 +119,7 @@ class PresentationAttributeCacheCleaner {
}
unsigned m_hitCount;
- Timer<PresentationAttributeCacheCleaner> m_cleanTimer;
+ TaskRunnerTimer<PresentationAttributeCacheCleaner> m_cleanTimer;
};
static bool attributeNameSort(const std::pair<StringImpl*, AtomicString>& p1,