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

Unified Diff: third_party/WebKit/Source/core/frame/FrameTimer.h

Issue 2430513003: Move some Document timers to frame-specific task runners. (Closed)
Patch Set: Created 4 years, 2 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
Index: third_party/WebKit/Source/core/frame/FrameTimer.h
diff --git a/third_party/WebKit/Source/core/frame/FrameTimer.h b/third_party/WebKit/Source/core/frame/FrameTimer.h
new file mode 100644
index 0000000000000000000000000000000000000000..aed5ab76fea9353d80a7c0b328534c2f029e3721
--- /dev/null
+++ b/third_party/WebKit/Source/core/frame/FrameTimer.h
@@ -0,0 +1,31 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef FrameTimer_h
+#define FrameTimer_h
+
+#include "core/dom/TaskRunnerHelper.h"
+#include "platform/Timer.h"
+
+namespace blink {
+
+template <typename TimerFiredClass>
+class FrameTimer : public TaskRunnerTimer<TimerFiredClass> {
haraken 2016/10/19 03:07:47 What's your plan in the end? Are you planning to m
dcheng 2016/10/19 03:47:44 The idea for FrameTimer is to make it easy to see
haraken 2016/10/19 09:07:12 Yeah, I'd prefer not mixing postCancellableTask, F
+ public:
+ using TimerFiredFunction =
+ typename TaskRunnerTimer<TimerFiredClass>::TimerFiredFunction;
+
+ FrameTimer(TaskType taskType,
+ Document* document,
dcheng 2016/10/19 00:08:39 I'll add additional overloads as needed?
haraken 2016/10/19 03:07:48 Sure. ExecutionContext* might be better since wor
dcheng 2016/10/19 03:47:44 Done.
+ TimerFiredClass* timerFiredClass,
+ TimerFiredFunction timerFiredFunction)
+ : TaskRunnerTimer<TimerFiredClass>(
+ TaskRunnerHelper::get(taskType, document),
+ timerFiredClass,
+ timerFiredFunction) {}
+};
+
+} // namespace blink
+
+#endif // FrameTimer_h

Powered by Google App Engine
This is Rietveld 408576698