| 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 CONTENT_CHILD_SCHEDULER_SCHEDULER_HELPER_H_ | 5 #ifndef CONTENT_CHILD_SCHEDULER_SCHEDULER_HELPER_H_ |
| 6 #define CONTENT_CHILD_SCHEDULER_SCHEDULER_HELPER_H_ | 6 #define CONTENT_CHILD_SCHEDULER_SCHEDULER_HELPER_H_ |
| 7 | 7 |
| 8 #include "cc/test/test_now_source.h" | 8 #include "cc/test/test_now_source.h" |
| 9 #include "content/child/scheduler/cancelable_closure_holder.h" | 9 #include "content/child/scheduler/cancelable_closure_holder.h" |
| 10 #include "content/child/scheduler/single_thread_idle_task_runner.h" | 10 #include "content/child/scheduler/single_thread_idle_task_runner.h" |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 static bool IsInIdlePeriod(IdlePeriodState state); | 151 static bool IsInIdlePeriod(IdlePeriodState state); |
| 152 | 152 |
| 153 void CheckOnValidThread() const { | 153 void CheckOnValidThread() const { |
| 154 DCHECK(thread_checker_.CalledOnValidThread()); | 154 DCHECK(thread_checker_.CalledOnValidThread()); |
| 155 } | 155 } |
| 156 | 156 |
| 157 // Accessor methods. | 157 // Accessor methods. |
| 158 base::TimeTicks Now() const; | 158 base::TimeTicks Now() const; |
| 159 IdlePeriodState SchedulerIdlePeriodState() const; | 159 IdlePeriodState SchedulerIdlePeriodState() const; |
| 160 PrioritizingTaskQueueSelector* SchedulerTaskQueueSelector() const; | 160 PrioritizingTaskQueueSelector* SchedulerTaskQueueSelector() const; |
| 161 TaskQueueManager* SchedulerTaskQueueManager() const; | 161 scoped_refptr<base::SingleThreadTaskRunner> TaskRunnerForQueue( |
| 162 size_t queue_index) const; |
| 163 void SetQueueName(size_t queue_index, const char* name); |
| 164 bool IsQueueEmpty(size_t queue_index) const; |
| 162 | 165 |
| 163 // Test helpers. | 166 // Test helpers. |
| 164 void SetTimeSourceForTesting(scoped_refptr<cc::TestNowSource> time_source); | 167 void SetTimeSourceForTesting(scoped_refptr<cc::TestNowSource> time_source); |
| 165 void SetWorkBatchSizeForTesting(size_t work_batch_size); | 168 void SetWorkBatchSizeForTesting(size_t work_batch_size); |
| 166 | 169 |
| 167 private: | 170 private: |
| 168 friend class SchedulerHelperTest; | 171 friend class SchedulerHelperTest; |
| 169 | 172 |
| 170 bool ShouldWaitForQuiescence(); | 173 bool ShouldWaitForQuiescence(); |
| 171 void EnableLongIdlePeriodAfterWakeup(); | 174 void EnableLongIdlePeriodAfterWakeup(); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 199 | 202 |
| 200 base::WeakPtr<SchedulerHelper> weak_scheduler_ptr_; | 203 base::WeakPtr<SchedulerHelper> weak_scheduler_ptr_; |
| 201 base::WeakPtrFactory<SchedulerHelper> weak_factory_; | 204 base::WeakPtrFactory<SchedulerHelper> weak_factory_; |
| 202 | 205 |
| 203 DISALLOW_COPY_AND_ASSIGN(SchedulerHelper); | 206 DISALLOW_COPY_AND_ASSIGN(SchedulerHelper); |
| 204 }; | 207 }; |
| 205 | 208 |
| 206 } // namespace content | 209 } // namespace content |
| 207 | 210 |
| 208 #endif // CONTENT_CHILD_SCHEDULER_SCHEDULER_HELPER_H_ | 211 #endif // CONTENT_CHILD_SCHEDULER_SCHEDULER_HELPER_H_ |
| OLD | NEW |