| 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 9dc47a325956e74bf4ccc6025fdbe84020a5b6ff..a38cb330afe30c750e592e99735054409b8660ab 100644
|
| --- a/third_party/WebKit/public/platform/scheduler/base/task_queue.h
|
| +++ b/third_party/WebKit/public/platform/scheduler/base/task_queue.h
|
| @@ -8,7 +8,6 @@
|
| #include "base/macros.h"
|
| #include "base/message_loop/message_loop.h"
|
| #include "base/single_thread_task_runner.h"
|
| -#include "base/trace_event/trace_event.h"
|
| #include "public/platform/WebCommon.h"
|
|
|
| namespace base {
|
| @@ -19,6 +18,10 @@ class BlameContext;
|
|
|
| namespace blink {
|
| namespace scheduler {
|
| +namespace internal {
|
| +class TaskQueueImpl;
|
| +} // namespace internal
|
| +class FakeWebTaskRunner;
|
| class LazyNow;
|
| class TimeDomain;
|
|
|
| @@ -136,6 +139,49 @@ class BLINK_PLATFORM_EXPORT TaskQueue : public base::SingleThreadTaskRunner {
|
| bool should_report_when_execution_blocked;
|
| };
|
|
|
| + // Intended to be used as an opaque handle to a task posted by
|
| + // PostCancellableDelayedTask.
|
| + class BLINK_PLATFORM_EXPORT TaskHandle {
|
| + public:
|
| + TaskHandle();
|
| +
|
| + // Returns false if the handle is equivalent to TaskHandle(), i.e. the
|
| + // handle doesn't represent a task that got posted.
|
| + operator bool() const;
|
| +
|
| + private:
|
| + friend internal::TaskQueueImpl;
|
| + friend FakeWebTaskRunner;
|
| +
|
| + // For immediate tasks.
|
| + TaskHandle(TaskQueue* task_queue, uint64_t enqueue_order);
|
| +
|
| + // For delayed tasks.
|
| + TaskHandle(TaskQueue* task_queue,
|
| + base::TimeTicks scheduled_run_time,
|
| + int sequence_number);
|
| +
|
| + uint64_t enqueue_order_;
|
| + base::TimeTicks scheduled_run_time_;
|
| +#if DCHECK_IS_ON()
|
| + TaskQueue* task_queue_;
|
| +#endif
|
| + int sequence_number_;
|
| + };
|
| +
|
| + // Posts the given task to be run after |delay| has passed. Returns a handle
|
| + // which can be passed to CancelTask to cancel the task before it has run.
|
| + // NOTE this must be called on the thread this TaskQueue was created by.
|
| + virtual TaskHandle PostCancellableDelayedTask(
|
| + const tracked_objects::Location& from_here,
|
| + const base::Closure& task,
|
| + base::TimeDelta delay) = 0;
|
| +
|
| + // Attempts to cancel a task posted by PostCancellableDelayedTask. Returns
|
| + // true on success or false otherwise. NOTE this must be called on the thread
|
| + // this TaskQueue was created by.
|
| + virtual bool CancelTask(const TaskHandle& handle) = 0;
|
| +
|
| // Enable or disable task execution for this queue. NOTE this must be called
|
| // on the thread this TaskQueue was created by.
|
| virtual void SetQueueEnabled(bool enabled) = 0;
|
|
|