| 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 THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_CHILD_IDLE_HELPER_H_ | 5 #ifndef THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_CHILD_IDLE_HELPER_H_ |
| 6 #define THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_CHILD_IDLE_HELPER_H_ | 6 #define THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_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 "platform/scheduler/base/cancelable_closure_holder.h" | 10 #include "platform/scheduler/base/cancelable_closure_holder.h" |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 // Must be called from the thread this class was created on. | 131 // Must be called from the thread this class was created on. |
| 132 bool CanExceedIdleDeadlineIfRequired() const; | 132 bool CanExceedIdleDeadlineIfRequired() const; |
| 133 | 133 |
| 134 // Returns the deadline for the current idle task. | 134 // Returns the deadline for the current idle task. |
| 135 base::TimeTicks CurrentIdleTaskDeadline() const; | 135 base::TimeTicks CurrentIdleTaskDeadline() const; |
| 136 | 136 |
| 137 // SingleThreadIdleTaskRunner::Delegate implementation: | 137 // SingleThreadIdleTaskRunner::Delegate implementation: |
| 138 void OnIdleTaskPosted() override; | 138 void OnIdleTaskPosted() override; |
| 139 base::TimeTicks WillProcessIdleTask() override; | 139 base::TimeTicks WillProcessIdleTask() override; |
| 140 void DidProcessIdleTask() override; | 140 void DidProcessIdleTask() override; |
| 141 base::TimeTicks NowTicks() override; |
| 141 | 142 |
| 142 // base::MessageLoop::TaskObserver implementation: | 143 // base::MessageLoop::TaskObserver implementation: |
| 143 void WillProcessTask(const base::PendingTask& pending_task) override; | 144 void WillProcessTask(const base::PendingTask& pending_task) override; |
| 144 void DidProcessTask(const base::PendingTask& pending_task) override; | 145 void DidProcessTask(const base::PendingTask& pending_task) override; |
| 145 | 146 |
| 146 IdlePeriodState SchedulerIdlePeriodState() const; | 147 IdlePeriodState SchedulerIdlePeriodState() const; |
| 147 static const char* IdlePeriodStateToString(IdlePeriodState state); | 148 static const char* IdlePeriodStateToString(IdlePeriodState state); |
| 148 | 149 |
| 149 private: | 150 private: |
| 150 friend class BaseIdleHelperTest; | 151 friend class BaseIdleHelperTest; |
| 151 friend class IdleHelperTest; | 152 friend class IdleHelperTest; |
| 152 | 153 |
| 154 const scoped_refptr<TaskQueue>& idle_queue() const { return idle_queue_; } |
| 155 |
| 153 class State { | 156 class State { |
| 154 public: | 157 public: |
| 155 State(SchedulerHelper* helper, | 158 State(SchedulerHelper* helper, |
| 156 Delegate* delegate, | 159 Delegate* delegate, |
| 157 const char* tracing_category, | 160 const char* tracing_category, |
| 158 const char* disabled_by_default_tracing_category, | 161 const char* disabled_by_default_tracing_category, |
| 159 const char* idle_period_tracing_name); | 162 const char* idle_period_tracing_name); |
| 160 virtual ~State(); | 163 virtual ~State(); |
| 161 | 164 |
| 162 void UpdateState(IdlePeriodState new_state, | 165 void UpdateState(IdlePeriodState new_state, |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 base::WeakPtr<IdleHelper> weak_idle_helper_ptr_; | 240 base::WeakPtr<IdleHelper> weak_idle_helper_ptr_; |
| 238 base::WeakPtrFactory<IdleHelper> weak_factory_; | 241 base::WeakPtrFactory<IdleHelper> weak_factory_; |
| 239 | 242 |
| 240 DISALLOW_COPY_AND_ASSIGN(IdleHelper); | 243 DISALLOW_COPY_AND_ASSIGN(IdleHelper); |
| 241 }; | 244 }; |
| 242 | 245 |
| 243 } // namespace scheduler | 246 } // namespace scheduler |
| 244 } // namespace blink | 247 } // namespace blink |
| 245 | 248 |
| 246 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_CHILD_IDLE_HELPER_H_ | 249 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_CHILD_IDLE_HELPER_H_ |
| OLD | NEW |