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 ac36e75926a4782d0284fa312d650b15bae76e80..815645cca187648a63c8620e214e9997b28c358b 100644 |
| --- a/third_party/WebKit/public/platform/scheduler/base/task_queue.h |
| +++ b/third_party/WebKit/public/platform/scheduler/base/task_queue.h |
| @@ -117,9 +117,32 @@ class BLINK_PLATFORM_EXPORT TaskQueue : public base::SingleThreadTaskRunner { |
| bool should_report_when_execution_blocked; |
| }; |
| - // 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; |
| + // An interface that lets the owner vote on whether or not the associated |
| + // TaskQueue should be enabled. |
| + class QueueEnabledVoter { |
|
Sami
2016/11/29 14:45:17
I think "voter" works but just to throw another (s
alex clarke (OOO till 29th)
2016/11/29 16:49:11
Acknowledged.
|
| + public: |
| + QueueEnabledVoter() {} |
| + virtual ~QueueEnabledVoter() {} |
| + |
| + // Votes to enable or disable the associated TaskQueue. The TaskQueue will |
| + // only be enabled if all the voters agree it should be enabled, or if there |
| + // are no voters. |
| + // NOTE this must be called on the thread the associated TaskQueue was |
| + // created on. |
| + virtual void SetQueueEnabled(bool enabled) = 0; |
| + |
| + // Returns the TaskQueue this voter votes on. |
| + virtual TaskQueue* GetTaskQueue() const = 0; |
|
Sami
2016/11/29 14:45:17
GetTaskQueueForTest? Doesn't seem like we need thi
alex clarke (OOO till 29th)
2016/11/29 16:49:11
Done.
|
| + |
| + private: |
| + DISALLOW_COPY_AND_ASSIGN(QueueEnabledVoter); |
| + }; |
| + |
| + // Returns an interface that allows the caller to vote on whether or not this |
| + // TaskQueue is enabled. The TaskQueue will be enabled if there are no voters |
| + // or of all agree it should be enabled. |
|
Sami
2016/11/29 14:45:17
s/of/if/
alex clarke (OOO till 29th)
2016/11/29 16:49:11
Done.
|
| + // NOTE this must be called on the thread this TaskQueue was created by. |
| + virtual std::unique_ptr<QueueEnabledVoter> GetQueueEnabledVoter() = 0; |
| // NOTE this must be called on the thread this TaskQueue was created by. |
| virtual bool IsQueueEnabled() const = 0; |