Move PresentationAttributeCacheCleaner timer to main thread's timer task runner. (issue 2647703006 by jbroman@chromium.org)

1 view
Skip to first unread message

jbr...@chromium.org

unread,
Jan 20, 2017, 3:50:30 PM1/20/17
to har...@chromium.org, blink-...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, chromium...@chromium.org, dglazko...@chromium.org, eae+bli...@chromium.org, rob....@samsung.com, sigb...@opera.com
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,


har...@chromium.org

unread,
Jan 20, 2017, 8:43:27 PM1/20/17
to jbr...@chromium.org, blink-...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, chromium...@chromium.org, dglazko...@chromium.org, eae+bli...@chromium.org, rob....@samsung.com, sigb...@opera.com
LGTM

Shall we add a comment about it?


https://codereview.chromium.org/2647703006/

jbr...@chromium.org

unread,
Jan 21, 2017, 12:14:11 AM1/21/17
to har...@chromium.org, blink-...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, chromium...@chromium.org, dglazko...@chromium.org, eae+bli...@chromium.org, rob....@samsung.com, sigb...@opera.com
On 2017/01/21 at 01:43:27, haraken wrote:
> LGTM
>
> Shall we add a comment about it?

commit-bot@chromium.org via codereview.chromium.org

unread,
Jan 21, 2017, 12:19:22 AM1/21/17
to jbr...@chromium.org, har...@chromium.org, commi...@chromium.org, blink-...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, chromium...@chromium.org, dglazko...@chromium.org, eae+bli...@chromium.org, rob....@samsung.com, sigb...@opera.com

commit-bot@chromium.org via codereview.chromium.org

unread,
Jan 21, 2017, 2:03:54 AM1/21/17
to jbr...@chromium.org, har...@chromium.org, commi...@chromium.org, blink-...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, chromium...@chromium.org, dglazko...@chromium.org, eae+bli...@chromium.org, rob....@samsung.com, sigb...@opera.com
Reply all
Reply to author
Forward
0 new messages