| 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 { | 97 const HistogramBase* num_tasks_before_detach_histogram() const { |
| 98 return num_tasks_before_detach_histogram_; |
| 99 } |
| 100 |
| 101 const HistogramBase* num_tasks_between_waits_histogram() const { |
| 98 return num_tasks_between_waits_histogram_; | 102 return num_tasks_between_waits_histogram_; |
| 99 } | 103 } |
| 100 | 104 |
| 101 private: | 105 private: |
| 102 class SchedulerSingleThreadTaskRunner; | 106 class SchedulerSingleThreadTaskRunner; |
| 103 class SchedulerWorkerDelegateImpl; | 107 class SchedulerWorkerDelegateImpl; |
| 104 | 108 |
| 105 SchedulerWorkerPoolImpl(StringPiece name, | 109 SchedulerWorkerPoolImpl(StringPiece name, |
| 106 SchedulerWorkerPoolParams::IORestriction | 110 SchedulerWorkerPoolParams::IORestriction |
| 107 io_restriction, | 111 io_restriction, |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 | 185 |
| 182 #if DCHECK_IS_ON() | 186 #if DCHECK_IS_ON() |
| 183 // Signaled when all workers have been created. | 187 // Signaled when all workers have been created. |
| 184 WaitableEvent workers_created_; | 188 WaitableEvent workers_created_; |
| 185 #endif | 189 #endif |
| 186 | 190 |
| 187 // TaskScheduler.DetachDuration.[worker pool name] histogram. Intentionally | 191 // TaskScheduler.DetachDuration.[worker pool name] histogram. Intentionally |
| 188 // leaked. | 192 // leaked. |
| 189 HistogramBase* const detach_duration_histogram_; | 193 HistogramBase* const detach_duration_histogram_; |
| 190 | 194 |
| 195 // TaskScheduler.NumTasksBeforeDetach.[worker pool name] histogram. |
| 196 // Intentionally leaked. |
| 197 HistogramBase* const num_tasks_before_detach_histogram_; |
| 198 |
| 191 // TaskScheduler.NumTasksBetweenWaits.[worker pool name] histogram. | 199 // TaskScheduler.NumTasksBetweenWaits.[worker pool name] histogram. |
| 192 // Intentionally leaked. | 200 // Intentionally leaked. |
| 193 HistogramBase* const num_tasks_between_waits_histogram_; | 201 HistogramBase* const num_tasks_between_waits_histogram_; |
| 194 | 202 |
| 195 // TaskScheduler.TaskLatency.[worker pool name].[task priority] histograms. | 203 // TaskScheduler.TaskLatency.[worker pool name].[task priority] histograms. |
| 196 // Indexed by task priority. Histograms are allocated on demand to reduce | 204 // Indexed by task priority. Histograms are allocated on demand to reduce |
| 197 // memory usage (some task priorities might never run in this | 205 // memory usage (some task priorities might never run in this |
| 198 // SchedulerThreadPoolImpl). Intentionally leaked. | 206 // SchedulerThreadPoolImpl). Intentionally leaked. |
| 199 subtle::AtomicWord | 207 subtle::AtomicWord |
| 200 task_latency_histograms_[static_cast<int>(TaskPriority::HIGHEST) + 1] = | 208 task_latency_histograms_[static_cast<int>(TaskPriority::HIGHEST) + 1] = |
| 201 {}; | 209 {}; |
| 202 | 210 |
| 203 TaskTracker* const task_tracker_; | 211 TaskTracker* const task_tracker_; |
| 204 DelayedTaskManager* const delayed_task_manager_; | 212 DelayedTaskManager* const delayed_task_manager_; |
| 205 | 213 |
| 206 DISALLOW_COPY_AND_ASSIGN(SchedulerWorkerPoolImpl); | 214 DISALLOW_COPY_AND_ASSIGN(SchedulerWorkerPoolImpl); |
| 207 }; | 215 }; |
| 208 | 216 |
| 209 } // namespace internal | 217 } // namespace internal |
| 210 } // namespace base | 218 } // namespace base |
| 211 | 219 |
| 212 #endif // BASE_TASK_SCHEDULER_SCHEDULER_WORKER_POOL_IMPL_H_ | 220 #endif // BASE_TASK_SCHEDULER_SCHEDULER_WORKER_POOL_IMPL_H_ |
| OLD | NEW |