| 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 "platform/scheduler/child/idle_helper.h" | 5 #include "platform/scheduler/child/idle_helper.h" |
| 6 | 6 |
| 7 #include "base/time/time.h" | 7 #include "base/time/time.h" |
| 8 #include "base/trace_event/trace_event.h" | 8 #include "base/trace_event/trace_event.h" |
| 9 #include "base/trace_event/trace_event_argument.h" | 9 #include "base/trace_event/trace_event_argument.h" |
| 10 #include "platform/scheduler/base/real_time_domain.h" | 10 #include "platform/scheduler/base/real_time_domain.h" |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 // If there is still idle work to do then just start the next idle period. | 258 // If there is still idle work to do then just start the next idle period. |
| 259 base::TimeDelta next_long_idle_period_delay; | 259 base::TimeDelta next_long_idle_period_delay; |
| 260 if (state_.idle_period_state() == | 260 if (state_.idle_period_state() == |
| 261 IdlePeriodState::IN_LONG_IDLE_PERIOD_WITH_MAX_DEADLINE) { | 261 IdlePeriodState::IN_LONG_IDLE_PERIOD_WITH_MAX_DEADLINE) { |
| 262 // If we are in a max deadline long idle period then start the next | 262 // If we are in a max deadline long idle period then start the next |
| 263 // idle period immediately. | 263 // idle period immediately. |
| 264 next_long_idle_period_delay = base::TimeDelta(); | 264 next_long_idle_period_delay = base::TimeDelta(); |
| 265 } else { | 265 } else { |
| 266 // Otherwise ensure that we kick the scheduler at the right time to | 266 // Otherwise ensure that we kick the scheduler at the right time to |
| 267 // initiate the next idle period. | 267 // initiate the next idle period. |
| 268 next_long_idle_period_delay = std::max( | 268 next_long_idle_period_delay = |
| 269 base::TimeDelta(), state_.idle_period_deadline() - | 269 std::max(base::TimeDelta(), |
| 270 helper_->scheduler_tqm_delegate()->NowTicks()); | 270 state_.idle_period_deadline() - |
| 271 helper_->scheduler_tqm_delegate()->NowTicks()); |
| 271 } | 272 } |
| 272 if (next_long_idle_period_delay.is_zero()) { | 273 if (next_long_idle_period_delay.is_zero()) { |
| 273 EnableLongIdlePeriod(); | 274 EnableLongIdlePeriod(); |
| 274 } else { | 275 } else { |
| 275 helper_->ControlTaskRunner()->PostDelayedTask( | 276 helper_->ControlTaskRunner()->PostDelayedTask( |
| 276 FROM_HERE, enable_next_long_idle_period_closure_.callback(), | 277 FROM_HERE, enable_next_long_idle_period_closure_.callback(), |
| 277 next_long_idle_period_delay); | 278 next_long_idle_period_delay); |
| 278 } | 279 } |
| 279 } | 280 } |
| 280 } | 281 } |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 503 case IdlePeriodState::IN_LONG_IDLE_PERIOD_PAUSED: | 504 case IdlePeriodState::IN_LONG_IDLE_PERIOD_PAUSED: |
| 504 return "in_long_idle_period_paused"; | 505 return "in_long_idle_period_paused"; |
| 505 default: | 506 default: |
| 506 NOTREACHED(); | 507 NOTREACHED(); |
| 507 return nullptr; | 508 return nullptr; |
| 508 } | 509 } |
| 509 } | 510 } |
| 510 | 511 |
| 511 } // namespace scheduler | 512 } // namespace scheduler |
| 512 } // namespace blink | 513 } // namespace blink |
| OLD | NEW |