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/macros.h" | 8 #include "base/macros.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "components/scheduler/base/cancelable_closure_holder.h" | 10 #include "components/scheduler/base/cancelable_closure_holder.h" |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
117 base::TimeTicks WillProcessIdleTask() override; | 117 base::TimeTicks WillProcessIdleTask() override; |
118 void DidProcessIdleTask() override; | 118 void DidProcessIdleTask() override; |
119 | 119 |
120 // base::MessageLoop::TaskObserver implementation: | 120 // base::MessageLoop::TaskObserver implementation: |
121 void WillProcessTask(const base::PendingTask& pending_task) override; | 121 void WillProcessTask(const base::PendingTask& pending_task) override; |
122 void DidProcessTask(const base::PendingTask& pending_task) override; | 122 void DidProcessTask(const base::PendingTask& pending_task) override; |
123 | 123 |
124 IdlePeriodState SchedulerIdlePeriodState() const; | 124 IdlePeriodState SchedulerIdlePeriodState() const; |
125 static const char* IdlePeriodStateToString(IdlePeriodState state); | 125 static const char* IdlePeriodStateToString(IdlePeriodState state); |
126 | 126 |
127 // Test helper | |
128 void RunIdleTasksForTesting(const base::Closure&); | |
Sami
2016/03/29 11:11:17
In this implementation all the idle callbacks are
szager1
2016/04/06 08:43:17
I changed the implementation to use a regular long
| |
129 | |
127 private: | 130 private: |
128 friend class BaseIdleHelperTest; | 131 friend class BaseIdleHelperTest; |
129 friend class IdleHelperTest; | 132 friend class IdleHelperTest; |
130 | 133 |
131 class State { | 134 class State { |
132 public: | 135 public: |
133 State(SchedulerHelper* helper, | 136 State(SchedulerHelper* helper, |
134 Delegate* delegate, | 137 Delegate* delegate, |
135 const char* tracing_category, | 138 const char* tracing_category, |
136 const char* disabled_by_default_tracing_category, | 139 const char* disabled_by_default_tracing_category, |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
212 | 215 |
213 base::WeakPtr<IdleHelper> weak_idle_helper_ptr_; | 216 base::WeakPtr<IdleHelper> weak_idle_helper_ptr_; |
214 base::WeakPtrFactory<IdleHelper> weak_factory_; | 217 base::WeakPtrFactory<IdleHelper> weak_factory_; |
215 | 218 |
216 DISALLOW_COPY_AND_ASSIGN(IdleHelper); | 219 DISALLOW_COPY_AND_ASSIGN(IdleHelper); |
217 }; | 220 }; |
218 | 221 |
219 } // namespace scheduler | 222 } // namespace scheduler |
220 | 223 |
221 #endif // COMPONENTS_SCHEDULER_CHILD_IDLE_HELPER_H_ | 224 #endif // COMPONENTS_SCHEDULER_CHILD_IDLE_HELPER_H_ |
OLD | NEW |