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/sequenced_task_runner.h" | |
21 #include "base/single_thread_task_runner.h" | |
gab
2016/10/31 19:10:11
Do need to add includes solely used by overrides.
fdoray
2016/10/31 19:44:51
Done.
| |
20 #include "base/strings/string_piece.h" | 22 #include "base/strings/string_piece.h" |
21 #include "base/synchronization/atomic_flag.h" | 23 #include "base/synchronization/atomic_flag.h" |
22 #include "base/synchronization/condition_variable.h" | 24 #include "base/synchronization/condition_variable.h" |
23 #include "base/task_runner.h" | 25 #include "base/task_runner.h" |
24 #include "base/task_scheduler/priority_queue.h" | 26 #include "base/task_scheduler/priority_queue.h" |
25 #include "base/task_scheduler/scheduler_lock.h" | 27 #include "base/task_scheduler/scheduler_lock.h" |
26 #include "base/task_scheduler/scheduler_worker.h" | 28 #include "base/task_scheduler/scheduler_worker.h" |
27 #include "base/task_scheduler/scheduler_worker_pool.h" | 29 #include "base/task_scheduler/scheduler_worker_pool.h" |
28 #include "base/task_scheduler/scheduler_worker_pool_params.h" | 30 #include "base/task_scheduler/scheduler_worker_pool_params.h" |
29 #include "base/task_scheduler/scheduler_worker_stack.h" | 31 #include "base/task_scheduler/scheduler_worker_stack.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
76 // Disallows worker thread detachment. If the suggested reclaim time is not | 78 // 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 | 79 // 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 | 80 // 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 | 81 // (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 | 82 // synchronization point for all workers (all threads are busy and can't be |
81 // reclaimed). | 83 // reclaimed). |
82 void DisallowWorkerDetachmentForTesting(); | 84 void DisallowWorkerDetachmentForTesting(); |
83 | 85 |
84 // SchedulerWorkerPool: | 86 // SchedulerWorkerPool: |
85 scoped_refptr<TaskRunner> CreateTaskRunnerWithTraits( | 87 scoped_refptr<TaskRunner> CreateTaskRunnerWithTraits( |
86 const TaskTraits& traits, | 88 const TaskTraits& traits) override; |
87 ExecutionMode execution_mode) override; | 89 scoped_refptr<SequencedTaskRunner> CreateSequencedTaskRunnerWithTraits( |
90 const TaskTraits& traits) override; | |
91 scoped_refptr<SingleThreadTaskRunner> CreateSingleThreadTaskRunnerWithTraits( | |
92 const TaskTraits& traits) override; | |
88 void ReEnqueueSequence(scoped_refptr<Sequence> sequence, | 93 void ReEnqueueSequence(scoped_refptr<Sequence> sequence, |
89 const SequenceSortKey& sequence_sort_key) override; | 94 const SequenceSortKey& sequence_sort_key) override; |
90 bool PostTaskWithSequence(std::unique_ptr<Task> task, | 95 bool PostTaskWithSequence(std::unique_ptr<Task> task, |
91 scoped_refptr<Sequence> sequence, | 96 scoped_refptr<Sequence> sequence, |
92 SchedulerWorker* worker) override; | 97 SchedulerWorker* worker) override; |
93 void PostTaskWithSequenceNow(std::unique_ptr<Task> task, | 98 void PostTaskWithSequenceNow(std::unique_ptr<Task> task, |
94 scoped_refptr<Sequence> sequence, | 99 scoped_refptr<Sequence> sequence, |
95 SchedulerWorker* worker) override; | 100 SchedulerWorker* worker) override; |
96 | 101 |
97 const HistogramBase* num_tasks_before_detach_histogram() const { | 102 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_; | 218 TaskTracker* const task_tracker_; |
214 DelayedTaskManager* const delayed_task_manager_; | 219 DelayedTaskManager* const delayed_task_manager_; |
215 | 220 |
216 DISALLOW_COPY_AND_ASSIGN(SchedulerWorkerPoolImpl); | 221 DISALLOW_COPY_AND_ASSIGN(SchedulerWorkerPoolImpl); |
217 }; | 222 }; |
218 | 223 |
219 } // namespace internal | 224 } // namespace internal |
220 } // namespace base | 225 } // namespace base |
221 | 226 |
222 #endif // BASE_TASK_SCHEDULER_SCHEDULER_WORKER_POOL_IMPL_H_ | 227 #endif // BASE_TASK_SCHEDULER_SCHEDULER_WORKER_POOL_IMPL_H_ |
OLD | NEW |