OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/child/scheduler/scheduler_helper.h" | 5 #include "content/child/scheduler/scheduler_helper.h" |
6 | 6 |
7 #include "base/trace_event/trace_event.h" | 7 #include "base/trace_event/trace_event.h" |
8 #include "base/trace_event/trace_event_argument.h" | 8 #include "base/trace_event/trace_event_argument.h" |
9 #include "content/child/scheduler/nestable_single_thread_task_runner.h" | 9 #include "content/child/scheduler/nestable_single_thread_task_runner.h" |
10 #include "content/child/scheduler/prioritizing_task_queue_selector.h" | 10 #include "content/child/scheduler/prioritizing_task_queue_selector.h" |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 TRACE_EVENT0(disabled_by_default_tracing_category_, "EnableLongIdlePeriod"); | 183 TRACE_EVENT0(disabled_by_default_tracing_category_, "EnableLongIdlePeriod"); |
184 CheckOnValidThread(); | 184 CheckOnValidThread(); |
185 | 185 |
186 // End any previous idle period. | 186 // End any previous idle period. |
187 EndIdlePeriod(); | 187 EndIdlePeriod(); |
188 | 188 |
189 if (ShouldWaitForQuiescence()) { | 189 if (ShouldWaitForQuiescence()) { |
190 control_task_runner_->PostDelayedTask( | 190 control_task_runner_->PostDelayedTask( |
191 FROM_HERE, enable_next_long_idle_period_closure_.callback(), | 191 FROM_HERE, enable_next_long_idle_period_closure_.callback(), |
192 required_quiescence_duration_before_long_idle_period_); | 192 required_quiescence_duration_before_long_idle_period_); |
193 scheduler_helper_delegate_->IsNotQuiescent(); | |
194 return; | 193 return; |
195 } | 194 } |
196 | 195 |
197 base::TimeTicks now(Now()); | 196 base::TimeTicks now(Now()); |
198 base::TimeDelta next_long_idle_period_delay; | 197 base::TimeDelta next_long_idle_period_delay; |
199 IdlePeriodState new_idle_period_state = | 198 IdlePeriodState new_idle_period_state = |
200 ComputeNewLongIdlePeriodState(now, &next_long_idle_period_delay); | 199 ComputeNewLongIdlePeriodState(now, &next_long_idle_period_delay); |
201 if (IsInIdlePeriod(new_idle_period_state)) { | 200 if (IsInIdlePeriod(new_idle_period_state)) { |
202 StartIdlePeriod(new_idle_period_state, now, | 201 StartIdlePeriod(new_idle_period_state, now, |
203 now + next_long_idle_period_delay, | 202 now + next_long_idle_period_delay, |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 } | 385 } |
387 | 386 |
388 void SchedulerHelper::RemoveTaskObserver( | 387 void SchedulerHelper::RemoveTaskObserver( |
389 base::MessageLoop::TaskObserver* task_observer) { | 388 base::MessageLoop::TaskObserver* task_observer) { |
390 CheckOnValidThread(); | 389 CheckOnValidThread(); |
391 if (task_queue_manager_) | 390 if (task_queue_manager_) |
392 task_queue_manager_->RemoveTaskObserver(task_observer); | 391 task_queue_manager_->RemoveTaskObserver(task_observer); |
393 } | 392 } |
394 | 393 |
395 } // namespace content | 394 } // namespace content |
OLD | NEW |