| 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 "components/scheduler/child/prioritizing_task_queue_selector.h" | 8 #include "components/scheduler/child/prioritizing_task_queue_selector.h" |
| 9 #include "components/scheduler/child/task_queue_manager.h" | 9 #include "components/scheduler/child/task_queue_manager.h" |
| 10 #include "components/scheduler/child/time_source.h" | |
| 11 #include "components/scheduler/scheduler_export.h" | 10 #include "components/scheduler/scheduler_export.h" |
| 12 | 11 |
| 12 namespace base { |
| 13 class TickClock; |
| 14 } |
| 15 |
| 13 namespace scheduler { | 16 namespace scheduler { |
| 14 | 17 |
| 15 class NestableSingleThreadTaskRunner; | 18 class NestableSingleThreadTaskRunner; |
| 16 | 19 |
| 17 // Common scheduler functionality for default tasks. | 20 // Common scheduler functionality for default tasks. |
| 18 class SCHEDULER_EXPORT SchedulerHelper { | 21 class SCHEDULER_EXPORT SchedulerHelper { |
| 19 public: | 22 public: |
| 20 // NOTE |total_task_queue_count| must be >= TASK_QUEUE_COUNT. | 23 // NOTE |total_task_queue_count| must be >= TASK_QUEUE_COUNT. |
| 21 // Category strings must have application lifetime (statics or | 24 // Category strings must have application lifetime (statics or |
| 22 // literals). They may not include " chars. | 25 // literals). They may not include " chars. |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 bool IsQueueEnabled(size_t queue_index) const; | 89 bool IsQueueEnabled(size_t queue_index) const; |
| 87 void SetPumpPolicy(size_t queue_index, | 90 void SetPumpPolicy(size_t queue_index, |
| 88 TaskQueueManager::PumpPolicy pump_policy); | 91 TaskQueueManager::PumpPolicy pump_policy); |
| 89 void SetWakeupPolicy(size_t queue_index, | 92 void SetWakeupPolicy(size_t queue_index, |
| 90 TaskQueueManager::WakeupPolicy wakeup_policy); | 93 TaskQueueManager::WakeupPolicy wakeup_policy); |
| 91 void PumpQueue(size_t queue_index); | 94 void PumpQueue(size_t queue_index); |
| 92 uint64 GetQuiescenceMonitoredTaskQueueMask() const; | 95 uint64 GetQuiescenceMonitoredTaskQueueMask() const; |
| 93 uint64 GetAndClearTaskWasRunOnQueueBitmap(); | 96 uint64 GetAndClearTaskWasRunOnQueueBitmap(); |
| 94 | 97 |
| 95 // Test helpers. | 98 // Test helpers. |
| 96 void SetTimeSourceForTesting(scoped_ptr<TimeSource> time_source); | 99 void SetTimeSourceForTesting(scoped_ptr<base::TickClock> time_source); |
| 97 void SetWorkBatchSizeForTesting(size_t work_batch_size); | 100 void SetWorkBatchSizeForTesting(size_t work_batch_size); |
| 98 TaskQueueManager* GetTaskQueueManagerForTesting(); | 101 TaskQueueManager* GetTaskQueueManagerForTesting(); |
| 99 | 102 |
| 100 private: | 103 private: |
| 101 friend class SchedulerHelperTest; | 104 friend class SchedulerHelperTest; |
| 102 | 105 |
| 103 base::ThreadChecker thread_checker_; | 106 base::ThreadChecker thread_checker_; |
| 104 scoped_ptr<PrioritizingTaskQueueSelector> task_queue_selector_; | 107 scoped_ptr<PrioritizingTaskQueueSelector> task_queue_selector_; |
| 105 scoped_ptr<TaskQueueManager> task_queue_manager_; | 108 scoped_ptr<TaskQueueManager> task_queue_manager_; |
| 106 | 109 |
| 107 uint64 quiescence_monitored_task_queue_mask_; | 110 uint64 quiescence_monitored_task_queue_mask_; |
| 108 | 111 |
| 109 scoped_refptr<base::SingleThreadTaskRunner> control_task_runner_; | 112 scoped_refptr<base::SingleThreadTaskRunner> control_task_runner_; |
| 110 scoped_refptr<base::SingleThreadTaskRunner> control_after_wakeup_task_runner_; | 113 scoped_refptr<base::SingleThreadTaskRunner> control_after_wakeup_task_runner_; |
| 111 scoped_refptr<base::SingleThreadTaskRunner> default_task_runner_; | 114 scoped_refptr<base::SingleThreadTaskRunner> default_task_runner_; |
| 112 | 115 |
| 113 scoped_ptr<TimeSource> time_source_; | 116 scoped_ptr<base::TickClock> time_source_; |
| 114 | 117 |
| 115 const char* tracing_category_; | 118 const char* tracing_category_; |
| 116 const char* disabled_by_default_tracing_category_; | 119 const char* disabled_by_default_tracing_category_; |
| 117 | 120 |
| 118 DISALLOW_COPY_AND_ASSIGN(SchedulerHelper); | 121 DISALLOW_COPY_AND_ASSIGN(SchedulerHelper); |
| 119 }; | 122 }; |
| 120 | 123 |
| 121 } // namespace scheduler | 124 } // namespace scheduler |
| 122 | 125 |
| 123 #endif // COMPONENTS_SCHEDULER_CHILD_SCHEDULER_HELPER_H_ | 126 #endif // COMPONENTS_SCHEDULER_CHILD_SCHEDULER_HELPER_H_ |
| OLD | NEW |