| 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 #ifndef COMPONENTS_SCHEDULER_CHILD_IDLE_HELPER_H_ | 5 #ifndef COMPONENTS_SCHEDULER_CHILD_IDLE_HELPER_H_ |
| 6 #define COMPONENTS_SCHEDULER_CHILD_IDLE_HELPER_H_ | 6 #define COMPONENTS_SCHEDULER_CHILD_IDLE_HELPER_H_ |
| 7 | 7 |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "components/scheduler/child/cancelable_closure_holder.h" | 9 #include "components/scheduler/child/cancelable_closure_holder.h" |
| 10 #include "components/scheduler/child/scheduler_helper.h" | 10 #include "components/scheduler/child/scheduler_helper.h" |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 void UpdateState(IdlePeriodState new_state, | 139 void UpdateState(IdlePeriodState new_state, |
| 140 base::TimeTicks new_deadline, | 140 base::TimeTicks new_deadline, |
| 141 base::TimeTicks optional_now); | 141 base::TimeTicks optional_now); |
| 142 bool IsIdlePeriodPaused() const; | 142 bool IsIdlePeriodPaused() const; |
| 143 | 143 |
| 144 IdlePeriodState idle_period_state() const; | 144 IdlePeriodState idle_period_state() const; |
| 145 base::TimeTicks idle_period_deadline() const; | 145 base::TimeTicks idle_period_deadline() const; |
| 146 | 146 |
| 147 void TraceIdleIdleTaskStart(); | 147 void TraceIdleIdleTaskStart(); |
| 148 void TraceIdleIdleTaskEnd(); | 148 void TraceIdleIdleTaskEnd(); |
| 149 void TraceEventIdlePeriodStateChange(IdlePeriodState new_state, | |
| 150 base::TimeTicks new_deadline, | |
| 151 base::TimeTicks optional_now); | |
| 152 | 149 |
| 153 private: | 150 private: |
| 151 void TraceEventIdlePeriodStateChange(IdlePeriodState new_state, |
| 152 bool new_running_idle_task, |
| 153 base::TraceTicks new_deadline, |
| 154 base::TraceTicks optional_now); |
| 155 |
| 154 SchedulerHelper* helper_; // NOT OWNED | 156 SchedulerHelper* helper_; // NOT OWNED |
| 155 Delegate* delegate_; // NOT OWNED | 157 Delegate* delegate_; // NOT OWNED |
| 156 | 158 |
| 157 IdlePeriodState idle_period_state_; | 159 IdlePeriodState idle_period_state_; |
| 158 base::TimeTicks idle_period_deadline_; | 160 base::TimeTicks idle_period_deadline_; |
| 159 | 161 |
| 160 base::TraceTicks idle_period_deadline_for_tracing_; | 162 base::TraceTicks idle_period_deadline_for_tracing_; |
| 161 base::TraceTicks last_idle_task_trace_time_; | 163 base::TraceTicks last_idle_task_trace_time_; |
| 162 bool nestable_events_started_; | 164 bool idle_period_trace_event_started_; |
| 165 bool running_idle_task_for_tracing_; |
| 163 const char* tracing_category_; | 166 const char* tracing_category_; |
| 164 const char* disabled_by_default_tracing_category_; | 167 const char* disabled_by_default_tracing_category_; |
| 165 const char* idle_period_tracing_name_; | 168 const char* idle_period_tracing_name_; |
| 166 | 169 |
| 167 DISALLOW_COPY_AND_ASSIGN(State); | 170 DISALLOW_COPY_AND_ASSIGN(State); |
| 168 }; | 171 }; |
| 169 | 172 |
| 170 // The minimum duration of an idle period. | 173 // The minimum duration of an idle period. |
| 171 static const int kMinimumIdlePeriodDurationMillis = 1; | 174 static const int kMinimumIdlePeriodDurationMillis = 1; |
| 172 | 175 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 | 212 |
| 210 base::WeakPtr<IdleHelper> weak_idle_helper_ptr_; | 213 base::WeakPtr<IdleHelper> weak_idle_helper_ptr_; |
| 211 base::WeakPtrFactory<IdleHelper> weak_factory_; | 214 base::WeakPtrFactory<IdleHelper> weak_factory_; |
| 212 | 215 |
| 213 DISALLOW_COPY_AND_ASSIGN(IdleHelper); | 216 DISALLOW_COPY_AND_ASSIGN(IdleHelper); |
| 214 }; | 217 }; |
| 215 | 218 |
| 216 } // namespace scheduler | 219 } // namespace scheduler |
| 217 | 220 |
| 218 #endif // COMPONENTS_SCHEDULER_CHILD_IDLE_HELPER_H_ | 221 #endif // COMPONENTS_SCHEDULER_CHILD_IDLE_HELPER_H_ |
| OLD | NEW |