Chromium Code Reviews| 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 de0d22ce45eb4f5bf4373b8beef0c3378ac7b9c4..8e51e02524d40ac53796f0b0ed8d26ea9568c450 100644 |
| --- a/third_party/WebKit/public/platform/scheduler/base/task_queue.h |
| +++ b/third_party/WebKit/public/platform/scheduler/base/task_queue.h |
| @@ -7,7 +7,9 @@ |
| #include "base/macros.h" |
| #include "base/message_loop/message_loop.h" |
| +#include "base/optional.h" |
| #include "base/single_thread_task_runner.h" |
| +#include "base/time/time.h" |
| #include "public/platform/WebCommon.h" |
| namespace base { |
| @@ -144,10 +146,29 @@ class BLINK_PLATFORM_EXPORT TaskQueue : public base::SingleThreadTaskRunner { |
| // Returns true if the queue is completely empty. |
| virtual bool IsEmpty() const = 0; |
| - // Returns true if the queue has work that's ready to execute now. NOTE this |
| - // must be called on the thread this TaskQueue was created by. |
| + // Returns true if the queue has work that's ready to execute now. |
| + // NOTE: this must be called on the thread this TaskQueue was created by. |
| virtual bool HasPendingImmediateWork() const = 0; |
| + // Returns requested run time of next delayed task, which is not ready |
| + // to run. If there are no such tasks, returns base::nullopt. |
| + // NOTE: this must be called on the thread this TaskQueue was created by. |
| + virtual base::Optional<base::TimeTicks> GetNextScheduledWakeUp() = 0; |
| + |
| + // Returns next point in time when the task from this queue is ready to run. |
| + // (now if there are immediate tasks or ready delayed task, run time |
| + // of earliest delayed task otherwise). |
| + // Returns base::nullopt if there are no tasks in this queue. |
| + // |
| + // NOTE: This function call is approximately equivalent to following: |
| + // if (HasPendingImmediateWork()) |
| + // return Now(); |
| + // return GetNextScheduledWakeUp(); |
| + // Difference is that GetNextTaskRunTime behaves "atomically" i.e. |
| + // it avoids problem when task becomes ready immediately after |
| + // HasPendingImmediateWork. |
| + virtual base::Optional<base::TimeTicks> GetNextTaskRunTime() = 0; |
|
alex clarke (OOO till 29th)
2016/09/14 12:36:34
No please don't put this here. It's confusing fro
altimin
2016/09/14 18:34:50
Done.
|
| + |
| // Can be called on any thread. |
| virtual const char* GetName() const = 0; |