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> |
11 #include <string> | 11 #include <string> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/atomicops.h" | |
15 #include "base/base_export.h" | 14 #include "base/base_export.h" |
16 #include "base/callback.h" | 15 #include "base/callback.h" |
17 #include "base/logging.h" | 16 #include "base/logging.h" |
18 #include "base/macros.h" | 17 #include "base/macros.h" |
19 #include "base/memory/ref_counted.h" | 18 #include "base/memory/ref_counted.h" |
20 #include "base/strings/string_piece.h" | 19 #include "base/strings/string_piece.h" |
21 #include "base/synchronization/atomic_flag.h" | 20 #include "base/synchronization/atomic_flag.h" |
22 #include "base/synchronization/condition_variable.h" | 21 #include "base/synchronization/condition_variable.h" |
23 #include "base/task_scheduler/priority_queue.h" | 22 #include "base/task_scheduler/priority_queue.h" |
24 #include "base/task_scheduler/scheduler_lock.h" | 23 #include "base/task_scheduler/scheduler_lock.h" |
25 #include "base/task_scheduler/scheduler_worker.h" | 24 #include "base/task_scheduler/scheduler_worker.h" |
26 #include "base/task_scheduler/scheduler_worker_pool.h" | 25 #include "base/task_scheduler/scheduler_worker_pool.h" |
27 #include "base/task_scheduler/scheduler_worker_pool_params.h" | 26 #include "base/task_scheduler/scheduler_worker_pool_params.h" |
28 #include "base/task_scheduler/scheduler_worker_stack.h" | 27 #include "base/task_scheduler/scheduler_worker_stack.h" |
29 #include "base/task_scheduler/sequence.h" | 28 #include "base/task_scheduler/sequence.h" |
30 #include "base/task_scheduler/task.h" | 29 #include "base/task_scheduler/task.h" |
31 #include "base/task_scheduler/task_traits.h" | |
32 #include "base/threading/platform_thread.h" | 30 #include "base/threading/platform_thread.h" |
33 | 31 |
34 namespace base { | 32 namespace base { |
35 | 33 |
36 class HistogramBase; | 34 class HistogramBase; |
| 35 class TaskTraits; |
37 class TimeDelta; | 36 class TimeDelta; |
38 | 37 |
39 namespace internal { | 38 namespace internal { |
40 | 39 |
41 class DelayedTaskManager; | 40 class DelayedTaskManager; |
42 class TaskTracker; | 41 class TaskTracker; |
43 | 42 |
44 // A pool of workers that run Tasks. This class is thread-safe. | 43 // A pool of workers that run Tasks. This class is thread-safe. |
45 class BASE_EXPORT SchedulerWorkerPoolImpl : public SchedulerWorkerPool { | 44 class BASE_EXPORT SchedulerWorkerPoolImpl : public SchedulerWorkerPool { |
46 public: | 45 public: |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 HistogramBase* const detach_duration_histogram_; | 196 HistogramBase* const detach_duration_histogram_; |
198 | 197 |
199 // TaskScheduler.NumTasksBeforeDetach.[worker pool name] histogram. | 198 // TaskScheduler.NumTasksBeforeDetach.[worker pool name] histogram. |
200 // Intentionally leaked. | 199 // Intentionally leaked. |
201 HistogramBase* const num_tasks_before_detach_histogram_; | 200 HistogramBase* const num_tasks_before_detach_histogram_; |
202 | 201 |
203 // TaskScheduler.NumTasksBetweenWaits.[worker pool name] histogram. | 202 // TaskScheduler.NumTasksBetweenWaits.[worker pool name] histogram. |
204 // Intentionally leaked. | 203 // Intentionally leaked. |
205 HistogramBase* const num_tasks_between_waits_histogram_; | 204 HistogramBase* const num_tasks_between_waits_histogram_; |
206 | 205 |
207 // TaskScheduler.TaskLatency.[worker pool name].[task priority] histograms. | |
208 // Indexed by task priority. Histograms are allocated on demand to reduce | |
209 // memory usage (some task priorities might never run in this | |
210 // SchedulerThreadPoolImpl). Intentionally leaked. | |
211 subtle::AtomicWord | |
212 task_latency_histograms_[static_cast<int>(TaskPriority::HIGHEST) + 1] = | |
213 {}; | |
214 | |
215 TaskTracker* const task_tracker_; | 206 TaskTracker* const task_tracker_; |
216 DelayedTaskManager* const delayed_task_manager_; | 207 DelayedTaskManager* const delayed_task_manager_; |
217 | 208 |
218 DISALLOW_COPY_AND_ASSIGN(SchedulerWorkerPoolImpl); | 209 DISALLOW_COPY_AND_ASSIGN(SchedulerWorkerPoolImpl); |
219 }; | 210 }; |
220 | 211 |
221 } // namespace internal | 212 } // namespace internal |
222 } // namespace base | 213 } // namespace base |
223 | 214 |
224 #endif // BASE_TASK_SCHEDULER_SCHEDULER_WORKER_POOL_IMPL_H_ | 215 #endif // BASE_TASK_SCHEDULER_SCHEDULER_WORKER_POOL_IMPL_H_ |
OLD | NEW |