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

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

Issue 2798563003: [scheduler] Add TaskQueue::Observer (Closed)
Patch Set: 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..64d9d35112d56e7f2ed1b3fcbcc721e3cb6c8380 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,17 @@ class BLINK_PLATFORM_EXPORT TaskQueue : public base::SingleThreadTaskRunner {
public:
TaskQueue() {}
+ class BLINK_PLATFORM_EXPORT Observer {
+ public:
+ virtual ~Observer() {}
+
+ // Notify observer that wakeup has changed. |next_wakeup| can be in the
+ // past (e.g. base::TimeTicks() can be used to notify about immediate
+ // work.
Sami 2017/04/04 19:07:30 Mention which thread this is called on.
Sami 2017/04/05 11:24:00 Also, did we wanna specify which functions can be
altimin 2017/04/05 11:35:58 Done.
altimin 2017/04/05 11:35:58 Done.
+ virtual void OnQueueNextWakeupChanged(TaskQueue* queue,
+ base::TimeTicks next_wakeup) = 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;
@@ -208,6 +219,9 @@ class BLINK_PLATFORM_EXPORT TaskQueue : public base::SingleThreadTaskRunner {
virtual bool BlockedByFence() const = 0;
+ virtual void AddObserver(Observer* observer) = 0;
+ virtual void RemoveObserver(Observer* observer) = 0;
+
protected:
~TaskQueue() override {}

Powered by Google App Engine
This is Rietveld 408576698