OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 BASE_TASK_SCHEDULER_SCHEDULER_WORKER_POOL_IMPL_H_ | 5 #ifndef BASE_TASK_SCHEDULER_SCHEDULER_WORKER_POOL_IMPL_H_ |
6 #define BASE_TASK_SCHEDULER_SCHEDULER_WORKER_POOL_IMPL_H_ | 6 #define BASE_TASK_SCHEDULER_SCHEDULER_WORKER_POOL_IMPL_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 ExecutionMode execution_mode) override; | 87 ExecutionMode execution_mode) override; |
88 void ReEnqueueSequence(scoped_refptr<Sequence> sequence, | 88 void ReEnqueueSequence(scoped_refptr<Sequence> sequence, |
89 const SequenceSortKey& sequence_sort_key) override; | 89 const SequenceSortKey& sequence_sort_key) override; |
90 bool PostTaskWithSequence(std::unique_ptr<Task> task, | 90 bool PostTaskWithSequence(std::unique_ptr<Task> task, |
91 scoped_refptr<Sequence> sequence, | 91 scoped_refptr<Sequence> sequence, |
92 SchedulerWorker* worker) override; | 92 SchedulerWorker* worker) override; |
93 void PostTaskWithSequenceNow(std::unique_ptr<Task> task, | 93 void PostTaskWithSequenceNow(std::unique_ptr<Task> task, |
94 scoped_refptr<Sequence> sequence, | 94 scoped_refptr<Sequence> sequence, |
95 SchedulerWorker* worker) override; | 95 SchedulerWorker* worker) override; |
96 | 96 |
| 97 const HistogramBase* num_tasks_between_waits_histogram_for_testing() const { |
| 98 return num_tasks_between_waits_histogram_; |
| 99 } |
| 100 |
97 private: | 101 private: |
98 class SchedulerSingleThreadTaskRunner; | 102 class SchedulerSingleThreadTaskRunner; |
99 class SchedulerWorkerDelegateImpl; | 103 class SchedulerWorkerDelegateImpl; |
100 | 104 |
101 SchedulerWorkerPoolImpl(StringPiece name, | 105 SchedulerWorkerPoolImpl(StringPiece name, |
102 SchedulerWorkerPoolParams::IORestriction | 106 SchedulerWorkerPoolParams::IORestriction |
103 io_restriction, | 107 io_restriction, |
104 const TimeDelta& suggested_reclaim_time, | 108 const TimeDelta& suggested_reclaim_time, |
105 TaskTracker* task_tracker, | 109 TaskTracker* task_tracker, |
106 DelayedTaskManager* delayed_task_manager); | 110 DelayedTaskManager* delayed_task_manager); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 | 174 |
171 #if DCHECK_IS_ON() | 175 #if DCHECK_IS_ON() |
172 // Signaled when all workers have been created. | 176 // Signaled when all workers have been created. |
173 WaitableEvent workers_created_; | 177 WaitableEvent workers_created_; |
174 #endif | 178 #endif |
175 | 179 |
176 // TaskScheduler.DetachDuration.[worker pool name] histogram. Intentionally | 180 // TaskScheduler.DetachDuration.[worker pool name] histogram. Intentionally |
177 // leaked. | 181 // leaked. |
178 HistogramBase* const detach_duration_histogram_; | 182 HistogramBase* const detach_duration_histogram_; |
179 | 183 |
| 184 // TaskScheduler.NumTasksBetweenWaits.[worker pool name] histogram. |
| 185 // Intentionally leaked. |
| 186 HistogramBase* const num_tasks_between_waits_histogram_; |
| 187 |
180 // TaskScheduler.TaskLatency.[worker pool name].[task priority] histograms. | 188 // TaskScheduler.TaskLatency.[worker pool name].[task priority] histograms. |
181 // Indexed by task priority. Histograms are allocated on demand to reduce | 189 // Indexed by task priority. Histograms are allocated on demand to reduce |
182 // memory usage (some task priorities might never run in this | 190 // memory usage (some task priorities might never run in this |
183 // SchedulerThreadPoolImpl). Intentionally leaked. | 191 // SchedulerThreadPoolImpl). Intentionally leaked. |
184 subtle::AtomicWord | 192 subtle::AtomicWord |
185 task_latency_histograms_[static_cast<int>(TaskPriority::HIGHEST) + 1] = | 193 task_latency_histograms_[static_cast<int>(TaskPriority::HIGHEST) + 1] = |
186 {}; | 194 {}; |
187 | 195 |
188 TaskTracker* const task_tracker_; | 196 TaskTracker* const task_tracker_; |
189 DelayedTaskManager* const delayed_task_manager_; | 197 DelayedTaskManager* const delayed_task_manager_; |
190 | 198 |
191 DISALLOW_COPY_AND_ASSIGN(SchedulerWorkerPoolImpl); | 199 DISALLOW_COPY_AND_ASSIGN(SchedulerWorkerPoolImpl); |
192 }; | 200 }; |
193 | 201 |
194 } // namespace internal | 202 } // namespace internal |
195 } // namespace base | 203 } // namespace base |
196 | 204 |
197 #endif // BASE_TASK_SCHEDULER_SCHEDULER_WORKER_POOL_IMPL_H_ | 205 #endif // BASE_TASK_SCHEDULER_SCHEDULER_WORKER_POOL_IMPL_H_ |
OLD | NEW |