Chromium Code Reviews| Index: third_party/WebKit/Source/platform/scheduler/renderer/task_queue_throttler.h |
| diff --git a/third_party/WebKit/Source/platform/scheduler/renderer/task_queue_throttler.h b/third_party/WebKit/Source/platform/scheduler/renderer/task_queue_throttler.h |
| index 9a8dd3f9956f209ad7b6d82de3a79650ba2eeb2b..97cb4843a70646aa704f2d15cf788a8a24f831be 100644 |
| --- a/third_party/WebKit/Source/platform/scheduler/renderer/task_queue_throttler.h |
| +++ b/third_party/WebKit/Source/platform/scheduler/renderer/task_queue_throttler.h |
| @@ -30,6 +30,9 @@ class BudgetPool; |
| class RendererSchedulerImpl; |
| class ThrottledTimeDomain; |
| class CPUTimeBudgetPool; |
| +class WakeupBudgetPool; |
| + |
| +enum class QueueBlockType { FULL, NEW_TASKS_ONLY }; |
|
alex clarke (OOO till 29th)
2017/04/21 09:14:19
These could do with some more documentation. I w
alex clarke (OOO till 29th)
2017/04/21 09:14:19
Are you thinking of adding more blocking types? C
altimin
2017/04/25 13:22:36
ALL_TASKS is a good idea, done.
I hoped that it w
|
| // Interface for BudgetPool to interact with TaskQueueThrottler. |
| class BLINK_PLATFORM_EXPORT BudgetPoolController { |
| @@ -48,7 +51,9 @@ class BLINK_PLATFORM_EXPORT BudgetPoolController { |
| // Insert a fence to prevent tasks from running and schedule a wake-up at |
| // an appropriate time. |
| - virtual void BlockQueue(base::TimeTicks now, TaskQueue* queue) = 0; |
| + virtual void BlockQueue(QueueBlockType block_type, |
| + base::TimeTicks now, |
| + TaskQueue* queue) = 0; |
| // Schedule a call to unblock queue at an appropriate moment. |
| virtual void UnblockQueue(base::TimeTicks now, TaskQueue* queue) = 0; |
| @@ -99,7 +104,9 @@ class BLINK_PLATFORM_EXPORT TaskQueueThrottler : public TaskQueue::Observer, |
| void RemoveQueueFromBudgetPool(TaskQueue* queue, |
| BudgetPool* budget_pool) override; |
| void UnregisterBudgetPool(BudgetPool* budget_pool) override; |
| - void BlockQueue(base::TimeTicks now, TaskQueue* queue) override; |
| + void BlockQueue(QueueBlockType block_type, |
| + base::TimeTicks now, |
| + TaskQueue* queue) override; |
| void UnblockQueue(base::TimeTicks now, TaskQueue* queue) override; |
| bool IsThrottled(TaskQueue* queue) const override; |
| @@ -132,6 +139,7 @@ class BLINK_PLATFORM_EXPORT TaskQueueThrottler : public TaskQueue::Observer, |
| // Returned object is owned by |TaskQueueThrottler|. |
| CPUTimeBudgetPool* CreateCPUTimeBudgetPool(const char* name); |
| + WakeupBudgetPool* CreateWakeupBudgetPool(const char* name); |
| // Accounts for given task for cpu-based throttling needs. |
| void OnTaskRunTimeReported(TaskQueue* task_queue, |
| @@ -162,7 +170,15 @@ class BLINK_PLATFORM_EXPORT TaskQueueThrottler : public TaskQueue::Observer, |
| // Return next possible time when queue is allowed to run in accordance |
| // with throttling policy. |
| - base::TimeTicks GetNextAllowedRunTime(base::TimeTicks now, TaskQueue* queue); |
| + base::TimeTicks GetNextAllowedRunTime(TaskQueue* queue, |
| + base::TimeTicks now, |
| + base::TimeTicks desired_run_time); |
| + |
| + bool CanRunTasksAt(TaskQueue* queue, base::TimeTicks moment); |
| + |
| + bool CanRunTasksUntil(TaskQueue* queue, |
| + base::TimeTicks now, |
| + base::TimeTicks moment); |
| void MaybeDeleteQueueMetadata(TaskQueueMap::iterator it); |
| @@ -171,6 +187,10 @@ class BLINK_PLATFORM_EXPORT TaskQueueThrottler : public TaskQueue::Observer, |
| base::TimeTicks now, |
| TaskQueue* queue); |
| + void OnTaskQueueHasWork(TaskQueue* queue, |
| + base::TimeTicks now, |
| + base::TimeTicks next_task_run_time); |
| + |
| TaskQueueMap queue_details_; |
| base::Callback<void(TaskQueue*, base::TimeTicks)> |
| forward_immediate_work_callback_; |