| 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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 base::TimeDelta::FromMilliseconds(kMinimumIdlePeriodDurationMillis)) { | 103 base::TimeDelta::FromMilliseconds(kMinimumIdlePeriodDurationMillis)) { |
| 104 *next_long_idle_period_delay_out = long_idle_period_duration; | 104 *next_long_idle_period_delay_out = long_idle_period_duration; |
| 105 if (!idle_queue_->HasPendingImmediateWork()) { | 105 if (!idle_queue_->HasPendingImmediateWork()) { |
| 106 return IdlePeriodState::IN_LONG_IDLE_PERIOD_PAUSED; | 106 return IdlePeriodState::IN_LONG_IDLE_PERIOD_PAUSED; |
| 107 } else if (long_idle_period_duration == max_long_idle_period_duration) { | 107 } else if (long_idle_period_duration == max_long_idle_period_duration) { |
| 108 return IdlePeriodState::IN_LONG_IDLE_PERIOD_WITH_MAX_DEADLINE; | 108 return IdlePeriodState::IN_LONG_IDLE_PERIOD_WITH_MAX_DEADLINE; |
| 109 } else { | 109 } else { |
| 110 return IdlePeriodState::IN_LONG_IDLE_PERIOD; | 110 return IdlePeriodState::IN_LONG_IDLE_PERIOD; |
| 111 } | 111 } |
| 112 } else { | 112 } else { |
| 113 // If we can't start the idle period yet then try again after wakeup. | 113 // If we can't start the idle period yet then try again after wake-up. |
| 114 *next_long_idle_period_delay_out = base::TimeDelta::FromMilliseconds( | 114 *next_long_idle_period_delay_out = base::TimeDelta::FromMilliseconds( |
| 115 kRetryEnableLongIdlePeriodDelayMillis); | 115 kRetryEnableLongIdlePeriodDelayMillis); |
| 116 return IdlePeriodState::NOT_IN_IDLE_PERIOD; | 116 return IdlePeriodState::NOT_IN_IDLE_PERIOD; |
| 117 } | 117 } |
| 118 } | 118 } |
| 119 | 119 |
| 120 bool IdleHelper::ShouldWaitForQuiescence() { | 120 bool IdleHelper::ShouldWaitForQuiescence() { |
| 121 helper_->CheckOnValidThread(); | 121 helper_->CheckOnValidThread(); |
| 122 | 122 |
| 123 if (required_quiescence_duration_before_long_idle_period_ == | 123 if (required_quiescence_duration_before_long_idle_period_ == |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 503 case IdlePeriodState::IN_LONG_IDLE_PERIOD_PAUSED: | 503 case IdlePeriodState::IN_LONG_IDLE_PERIOD_PAUSED: |
| 504 return "in_long_idle_period_paused"; | 504 return "in_long_idle_period_paused"; |
| 505 default: | 505 default: |
| 506 NOTREACHED(); | 506 NOTREACHED(); |
| 507 return nullptr; | 507 return nullptr; |
| 508 } | 508 } |
| 509 } | 509 } |
| 510 | 510 |
| 511 } // namespace scheduler | 511 } // namespace scheduler |
| 512 } // namespace blink | 512 } // namespace blink |
| OLD | NEW |