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

Unified Diff: third_party/WebKit/public/platform/scheduler/base/task_queue.h

Issue 2798563003: [scheduler] Add TaskQueue::Observer (Closed)
Patch Set: add todo for test timings & wake_up -> wake-up in comments Created 3 years, 8 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/public/platform/scheduler/base/task_queue.h
diff --git a/third_party/WebKit/public/platform/scheduler/base/task_queue.h b/third_party/WebKit/public/platform/scheduler/base/task_queue.h
index c57d23737a45a6631b7991d86b23c51ebe1f14ea..fae92bf351882e38422ff24a6595be479261e805 100644
--- a/third_party/WebKit/public/platform/scheduler/base/task_queue.h
+++ b/third_party/WebKit/public/platform/scheduler/base/task_queue.h
@@ -27,6 +27,20 @@ class BLINK_PLATFORM_EXPORT TaskQueue : public base::SingleThreadTaskRunner {
public:
TaskQueue() {}
+ class BLINK_PLATFORM_EXPORT Observer {
+ public:
+ virtual ~Observer() {}
+
+ // Notify observer that wake_up has changed. |next_wakeup| can be in the
Sami 2017/04/05 13:16:52 s/wake_up/the time at which this queue wants to ru
altimin 2017/04/05 13:55:18 Done.
+ // past (e.g. base::TimeTicks() can be used to notify about immediate
Sami 2017/04/05 13:16:51 Missing ')'
altimin 2017/04/05 13:55:18 Done.
+ // work.
+ // Can be called on any thread
+ // All methods but SetObserver, SetTimeDomain and GetTimeDomain can be
+ // called on |queue|.
+ virtual void OnQueueNextWakeUpChanged(TaskQueue* queue,
+ base::TimeTicks next_wake_up) = 0;
+ };
+
// Unregisters the task queue after which no tasks posted to it will run and
// the TaskQueueManager's reference to it will be released soon.
virtual void UnregisterTaskQueue() = 0;
@@ -150,7 +164,7 @@ class BLINK_PLATFORM_EXPORT TaskQueue : public base::SingleThreadTaskRunner {
// NOTE: this must be called on the thread this TaskQueue was created by.
virtual bool HasPendingImmediateWork() const = 0;
- // Returns requested run time of next scheduled wakeup for a delayed task
+ // Returns requested run time of next scheduled wake_up for a delayed task
Sami 2017/04/05 13:16:52 nit: no underscore
altimin 2017/04/05 13:55:18 Done.
// which is not ready to run. If there are no such tasks or the queue is
// disabled (by a QueueEnabledVoter) it returns base::nullopt.
// NOTE: this must be called on the thread this TaskQueue was created by.
@@ -208,6 +222,8 @@ class BLINK_PLATFORM_EXPORT TaskQueue : public base::SingleThreadTaskRunner {
virtual bool BlockedByFence() const = 0;
+ virtual void SetObserver(Observer* observer) = 0;
+
protected:
~TaskQueue() override {}

Powered by Google App Engine
This is Rietveld 408576698