| 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_SCHEDULER_HELPER_H_ | 5 #ifndef COMPONENTS_SCHEDULER_CHILD_SCHEDULER_HELPER_H_ |
| 6 #define COMPONENTS_SCHEDULER_CHILD_SCHEDULER_HELPER_H_ | 6 #define COMPONENTS_SCHEDULER_CHILD_SCHEDULER_HELPER_H_ |
| 7 | 7 |
| 8 #include "base/time/tick_clock.h" |
| 8 #include "components/scheduler/base/task_queue_manager.h" | 9 #include "components/scheduler/base/task_queue_manager.h" |
| 9 #include "components/scheduler/base/task_queue_selector.h" | 10 #include "components/scheduler/base/task_queue_selector.h" |
| 10 #include "components/scheduler/scheduler_export.h" | 11 #include "components/scheduler/scheduler_export.h" |
| 11 | 12 |
| 12 namespace base { | 13 namespace base { |
| 13 class TickClock; | 14 class TickClock; |
| 14 } | 15 } |
| 15 | 16 |
| 16 namespace scheduler { | 17 namespace scheduler { |
| 17 | 18 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 virtual void OnUnregisterTaskQueue( | 75 virtual void OnUnregisterTaskQueue( |
| 75 const scoped_refptr<TaskQueue>& queue) = 0; | 76 const scoped_refptr<TaskQueue>& queue) = 0; |
| 76 }; | 77 }; |
| 77 | 78 |
| 78 // Called once to set the Observer. This function is called on the main | 79 // Called once to set the Observer. This function is called on the main |
| 79 // thread. If |observer| is null, then no callbacks will occur. | 80 // thread. If |observer| is null, then no callbacks will occur. |
| 80 // Note |observer| is expected to outlive the SchedulerHelper. | 81 // Note |observer| is expected to outlive the SchedulerHelper. |
| 81 void SetObserver(Observer* observer); | 82 void SetObserver(Observer* observer); |
| 82 | 83 |
| 83 // Accessor methods. | 84 // Accessor methods. |
| 84 base::TimeTicks Now() const; | 85 base::TickClock* tick_clock() const; |
| 85 base::TimeTicks NextPendingDelayedTaskRunTime() const; | 86 base::TimeTicks NextPendingDelayedTaskRunTime() const; |
| 86 bool GetAndClearSystemIsQuiescentBit(); | 87 bool GetAndClearSystemIsQuiescentBit(); |
| 87 | 88 |
| 88 // Test helpers. | 89 // Test helpers. |
| 89 void SetTimeSourceForTesting(scoped_ptr<base::TickClock> time_source); | |
| 90 void SetWorkBatchSizeForTesting(size_t work_batch_size); | 90 void SetWorkBatchSizeForTesting(size_t work_batch_size); |
| 91 TaskQueueManager* GetTaskQueueManagerForTesting(); | 91 TaskQueueManager* GetTaskQueueManagerForTesting(); |
| 92 | 92 |
| 93 private: | 93 private: |
| 94 friend class SchedulerHelperTest; | 94 friend class SchedulerHelperTest; |
| 95 | 95 |
| 96 base::ThreadChecker thread_checker_; | 96 base::ThreadChecker thread_checker_; |
| 97 scoped_refptr<SchedulerTaskRunnerDelegate> main_task_runner_; | 97 scoped_refptr<SchedulerTaskRunnerDelegate> main_task_runner_; |
| 98 scoped_ptr<TaskQueueManager> task_queue_manager_; | 98 scoped_ptr<TaskQueueManager> task_queue_manager_; |
| 99 scoped_refptr<TaskQueue> control_task_runner_; | 99 scoped_refptr<TaskQueue> control_task_runner_; |
| 100 scoped_refptr<TaskQueue> control_after_wakeup_task_runner_; | 100 scoped_refptr<TaskQueue> control_after_wakeup_task_runner_; |
| 101 scoped_refptr<TaskQueue> default_task_runner_; | 101 scoped_refptr<TaskQueue> default_task_runner_; |
| 102 | 102 |
| 103 scoped_ptr<base::TickClock> time_source_; | |
| 104 | |
| 105 Observer* observer_; // NOT OWNED | 103 Observer* observer_; // NOT OWNED |
| 106 const char* tracing_category_; | 104 const char* tracing_category_; |
| 107 const char* disabled_by_default_tracing_category_; | 105 const char* disabled_by_default_tracing_category_; |
| 108 | 106 |
| 109 DISALLOW_COPY_AND_ASSIGN(SchedulerHelper); | 107 DISALLOW_COPY_AND_ASSIGN(SchedulerHelper); |
| 110 }; | 108 }; |
| 111 | 109 |
| 112 } // namespace scheduler | 110 } // namespace scheduler |
| 113 | 111 |
| 114 #endif // COMPONENTS_SCHEDULER_CHILD_SCHEDULER_HELPER_H_ | 112 #endif // COMPONENTS_SCHEDULER_CHILD_SCHEDULER_HELPER_H_ |
| OLD | NEW |