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" | 14 #include "base/atomicops.h" |
15 #include "base/base_export.h" | 15 #include "base/base_export.h" |
16 #include "base/callback.h" | 16 #include "base/callback.h" |
17 #include "base/logging.h" | 17 #include "base/logging.h" |
18 #include "base/macros.h" | 18 #include "base/macros.h" |
19 #include "base/memory/ref_counted.h" | 19 #include "base/memory/ref_counted.h" |
20 #include "base/strings/string_piece.h" | 20 #include "base/strings/string_piece.h" |
21 #include "base/synchronization/atomic_flag.h" | 21 #include "base/synchronization/atomic_flag.h" |
22 #include "base/synchronization/condition_variable.h" | 22 #include "base/synchronization/condition_variable.h" |
23 #include "base/task_runner.h" | |
24 #include "base/task_scheduler/priority_queue.h" | 23 #include "base/task_scheduler/priority_queue.h" |
25 #include "base/task_scheduler/scheduler_lock.h" | 24 #include "base/task_scheduler/scheduler_lock.h" |
26 #include "base/task_scheduler/scheduler_worker.h" | 25 #include "base/task_scheduler/scheduler_worker.h" |
27 #include "base/task_scheduler/scheduler_worker_pool.h" | 26 #include "base/task_scheduler/scheduler_worker_pool.h" |
28 #include "base/task_scheduler/scheduler_worker_pool_params.h" | 27 #include "base/task_scheduler/scheduler_worker_pool_params.h" |
29 #include "base/task_scheduler/scheduler_worker_stack.h" | 28 #include "base/task_scheduler/scheduler_worker_stack.h" |
30 #include "base/task_scheduler/sequence.h" | 29 #include "base/task_scheduler/sequence.h" |
31 #include "base/task_scheduler/task.h" | 30 #include "base/task_scheduler/task.h" |
32 #include "base/task_scheduler/task_traits.h" | 31 #include "base/task_scheduler/task_traits.h" |
33 #include "base/threading/platform_thread.h" | 32 #include "base/threading/platform_thread.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 // Disallows worker thread detachment. If the suggested reclaim time is not | 75 // Disallows worker thread detachment. If the suggested reclaim time is not |
77 // TimeDelta::Max(), then the test should call this before the detach code can | 76 // TimeDelta::Max(), then the test should call this before the detach code can |
78 // run. The safest place to do this is before the a set of work is dispatched | 77 // run. The safest place to do this is before the a set of work is dispatched |
79 // (the worker pool is idle and steady state) or before the last | 78 // (the worker pool is idle and steady state) or before the last |
80 // synchronization point for all workers (all threads are busy and can't be | 79 // synchronization point for all workers (all threads are busy and can't be |
81 // reclaimed). | 80 // reclaimed). |
82 void DisallowWorkerDetachmentForTesting(); | 81 void DisallowWorkerDetachmentForTesting(); |
83 | 82 |
84 // SchedulerWorkerPool: | 83 // SchedulerWorkerPool: |
85 scoped_refptr<TaskRunner> CreateTaskRunnerWithTraits( | 84 scoped_refptr<TaskRunner> CreateTaskRunnerWithTraits( |
86 const TaskTraits& traits, | 85 const TaskTraits& traits) override; |
87 ExecutionMode execution_mode) override; | 86 scoped_refptr<SequencedTaskRunner> CreateSequencedTaskRunnerWithTraits( |
| 87 const TaskTraits& traits) override; |
| 88 scoped_refptr<SingleThreadTaskRunner> CreateSingleThreadTaskRunnerWithTraits( |
| 89 const TaskTraits& traits) override; |
88 void ReEnqueueSequence(scoped_refptr<Sequence> sequence, | 90 void ReEnqueueSequence(scoped_refptr<Sequence> sequence, |
89 const SequenceSortKey& sequence_sort_key) override; | 91 const SequenceSortKey& sequence_sort_key) override; |
90 bool PostTaskWithSequence(std::unique_ptr<Task> task, | 92 bool PostTaskWithSequence(std::unique_ptr<Task> task, |
91 scoped_refptr<Sequence> sequence, | 93 scoped_refptr<Sequence> sequence, |
92 SchedulerWorker* worker) override; | 94 SchedulerWorker* worker) override; |
93 void PostTaskWithSequenceNow(std::unique_ptr<Task> task, | 95 void PostTaskWithSequenceNow(std::unique_ptr<Task> task, |
94 scoped_refptr<Sequence> sequence, | 96 scoped_refptr<Sequence> sequence, |
95 SchedulerWorker* worker) override; | 97 SchedulerWorker* worker) override; |
96 | 98 |
97 const HistogramBase* num_tasks_before_detach_histogram() const { | 99 const HistogramBase* num_tasks_before_detach_histogram() const { |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 TaskTracker* const task_tracker_; | 215 TaskTracker* const task_tracker_; |
214 DelayedTaskManager* const delayed_task_manager_; | 216 DelayedTaskManager* const delayed_task_manager_; |
215 | 217 |
216 DISALLOW_COPY_AND_ASSIGN(SchedulerWorkerPoolImpl); | 218 DISALLOW_COPY_AND_ASSIGN(SchedulerWorkerPoolImpl); |
217 }; | 219 }; |
218 | 220 |
219 } // namespace internal | 221 } // namespace internal |
220 } // namespace base | 222 } // namespace base |
221 | 223 |
222 #endif // BASE_TASK_SCHEDULER_SCHEDULER_WORKER_POOL_IMPL_H_ | 224 #endif // BASE_TASK_SCHEDULER_SCHEDULER_WORKER_POOL_IMPL_H_ |
OLD | NEW |