Chromium Code Reviews| Index: components/scheduler/renderer/renderer_scheduler_impl.cc |
| diff --git a/components/scheduler/renderer/renderer_scheduler_impl.cc b/components/scheduler/renderer/renderer_scheduler_impl.cc |
| index 9936a69f9fa5b9489f626e9bc478d8b8048f80a0..decbe1ec294af913268c44152835644157fec51c 100644 |
| --- a/components/scheduler/renderer/renderer_scheduler_impl.cc |
| +++ b/components/scheduler/renderer/renderer_scheduler_impl.cc |
| @@ -199,6 +199,10 @@ scoped_refptr<TaskQueue> RendererSchedulerImpl::NewLoadingTaskRunner( |
| MainThreadOnly().current_policy.loading_queue_policy.is_enabled); |
| loading_task_queue->SetQueuePriority( |
| MainThreadOnly().current_policy.loading_queue_policy.priority); |
| + if (MainThreadOnly().current_policy.loading_queue_policy.time_domain_type == |
| + TimeDomainType::THROTTLED) { |
| + throttling_helper_->IncreaseThrottleRefCount(loading_task_queue.get()); |
| + } |
| loading_task_queue->AddTaskObserver( |
| &MainThreadOnly().loading_task_cost_estimator); |
| return loading_task_queue; |
| @@ -216,6 +220,10 @@ scoped_refptr<TaskQueue> RendererSchedulerImpl::NewTimerTaskRunner( |
| MainThreadOnly().current_policy.timer_queue_policy.is_enabled); |
| timer_task_queue->SetQueuePriority( |
| MainThreadOnly().current_policy.timer_queue_policy.priority); |
| + if (MainThreadOnly().current_policy.timer_queue_policy.time_domain_type == |
| + TimeDomainType::THROTTLED) { |
| + throttling_helper_->IncreaseThrottleRefCount(timer_task_queue.get()); |
|
Sami
2016/05/31 18:11:04
Good catch with these two.
alex clarke (OOO till 29th)
2016/06/02 13:51:05
Acknowledged.
|
| + } |
| timer_task_queue->AddTaskObserver( |
| &MainThreadOnly().timer_task_cost_estimator); |
| return timer_task_queue; |
| @@ -830,6 +838,7 @@ void RendererSchedulerImpl::UpdatePolicyLocked(UpdateType update_type) { |
| if (MainThreadOnly().timer_queue_suspend_count != 0 || |
| MainThreadOnly().timer_queue_suspended_when_backgrounded) { |
| new_policy.timer_queue_policy.is_enabled = false; |
| + new_policy.timer_queue_policy.time_domain_type = TimeDomainType::REAL; |
| } |
| // Tracing is done before the early out check, because it's quite possible we |
| @@ -890,13 +899,16 @@ void RendererSchedulerImpl::ApplyTaskQueuePolicy( |
| TaskQueue* task_queue, |
| const TaskQueuePolicy& old_task_queue_policy, |
| const TaskQueuePolicy& new_task_queue_policy) const { |
| - // The ThrottlingHelper also calls SetQueueEnabled, so we can avoid calling |
| - // this here. |
| - if (new_task_queue_policy.time_domain_type != TimeDomainType::THROTTLED) |
| - task_queue->SetQueueEnabled(new_task_queue_policy.is_enabled); |
| + if (old_task_queue_policy.is_enabled != new_task_queue_policy.is_enabled) { |
| + throttling_helper_->SetQueueEnabled(task_queue, |
| + new_task_queue_policy.is_enabled); |
| + } |
| + |
| if (old_task_queue_policy.priority != new_task_queue_policy.priority) |
| task_queue->SetQueuePriority(new_task_queue_policy.priority); |
| + // if (new_task_queue_policy.time_domain_type != TimeDomainType::THROTTLED) |
|
Sami
2016/05/31 18:11:04
Debugging left in by mistake?
alex clarke (OOO till 29th)
2016/06/02 13:51:05
Done.
|
| + // task_queue->SetQueueEnabled(new_task_queue_policy.is_enabled); |
| if (old_task_queue_policy.time_domain_type != |
| new_task_queue_policy.time_domain_type) { |
| if (new_task_queue_policy.time_domain_type == TimeDomainType::THROTTLED) { |
| @@ -1021,10 +1033,10 @@ void RendererSchedulerImpl::SuspendTimerQueue() { |
| MainThreadOnly().timer_queue_suspend_count++; |
| ForceUpdatePolicy(); |
| #ifndef NDEBUG |
| - DCHECK(!default_timer_task_runner_->IsQueueEnabled()); |
| - for (const auto& runner : timer_task_runners_) { |
| - DCHECK(!runner->IsQueueEnabled()); |
| - } |
| +// DCHECK(!default_timer_task_runner_->IsQueueEnabled()); |
|
Sami
2016/05/31 18:11:04
Ditto.
alex clarke (OOO till 29th)
2016/06/02 13:51:05
Done.
|
| +// for (const auto& runner : timer_task_runners_) { |
| +// DCHECK(!runner->IsQueueEnabled()); |
| +// } |
| #endif |
| } |