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_TASK_SCHEDULER_IMPL_H_ | 5 #ifndef BASE_TASK_SCHEDULER_TASK_SCHEDULER_IMPL_H_ |
6 #define BASE_TASK_SCHEDULER_TASK_SCHEDULER_IMPL_H_ | 6 #define BASE_TASK_SCHEDULER_TASK_SCHEDULER_IMPL_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/base_export.h" | 13 #include "base/base_export.h" |
14 #include "base/callback.h" | 14 #include "base/callback.h" |
15 #include "base/logging.h" | 15 #include "base/logging.h" |
16 #include "base/macros.h" | 16 #include "base/macros.h" |
17 #include "base/memory/ref_counted.h" | 17 #include "base/memory/ref_counted.h" |
18 #include "base/sequenced_task_runner.h" | |
19 #include "base/single_thread_task_runner.h" | |
gab
2016/10/31 19:10:11
rm
fdoray
2016/10/31 19:44:51
Done.
| |
18 #include "base/synchronization/atomic_flag.h" | 20 #include "base/synchronization/atomic_flag.h" |
19 #include "base/task_runner.h" | 21 #include "base/task_runner.h" |
20 #include "base/task_scheduler/scheduler_worker_pool_impl.h" | 22 #include "base/task_scheduler/scheduler_worker_pool_impl.h" |
21 #include "base/task_scheduler/sequence.h" | 23 #include "base/task_scheduler/sequence.h" |
22 #include "base/task_scheduler/task_scheduler.h" | 24 #include "base/task_scheduler/task_scheduler.h" |
23 #include "base/task_scheduler/task_traits.h" | 25 #include "base/task_scheduler/task_traits.h" |
24 #include "base/threading/thread.h" | 26 #include "base/threading/thread.h" |
25 | 27 |
26 namespace base { | 28 namespace base { |
27 | 29 |
(...skipping 21 matching lines...) Expand all Loading... | |
49 // Destroying a TaskSchedulerImpl is not allowed in production; it is always | 51 // Destroying a TaskSchedulerImpl is not allowed in production; it is always |
50 // leaked. In tests, it can only be destroyed after JoinForTesting() has | 52 // leaked. In tests, it can only be destroyed after JoinForTesting() has |
51 // returned. | 53 // returned. |
52 ~TaskSchedulerImpl() override; | 54 ~TaskSchedulerImpl() override; |
53 | 55 |
54 // TaskScheduler: | 56 // TaskScheduler: |
55 void PostTaskWithTraits(const tracked_objects::Location& from_here, | 57 void PostTaskWithTraits(const tracked_objects::Location& from_here, |
56 const TaskTraits& traits, | 58 const TaskTraits& traits, |
57 const Closure& task) override; | 59 const Closure& task) override; |
58 scoped_refptr<TaskRunner> CreateTaskRunnerWithTraits( | 60 scoped_refptr<TaskRunner> CreateTaskRunnerWithTraits( |
59 const TaskTraits& traits, | 61 const TaskTraits& traits) override; |
60 ExecutionMode execution_mode) override; | 62 scoped_refptr<SequencedTaskRunner> CreateSequencedTaskRunnerWithTraits( |
63 const TaskTraits& traits) override; | |
64 scoped_refptr<SingleThreadTaskRunner> CreateSingleThreadTaskRunnerWithTraits( | |
65 const TaskTraits& traits) override; | |
61 std::vector<const HistogramBase*> GetHistograms() const override; | 66 std::vector<const HistogramBase*> GetHistograms() const override; |
62 void Shutdown() override; | 67 void Shutdown() override; |
63 void FlushForTesting() override; | 68 void FlushForTesting() override; |
64 | 69 |
65 // Joins all threads of this scheduler. Tasks that are already running are | 70 // Joins all threads of this scheduler. Tasks that are already running are |
66 // allowed to complete their execution. This can only be called once. | 71 // allowed to complete their execution. This can only be called once. |
67 void JoinForTesting(); | 72 void JoinForTesting(); |
68 | 73 |
69 private: | 74 private: |
70 explicit TaskSchedulerImpl(const WorkerPoolIndexForTraitsCallback& | 75 explicit TaskSchedulerImpl(const WorkerPoolIndexForTraitsCallback& |
(...skipping 20 matching lines...) Expand all Loading... | |
91 AtomicFlag join_for_testing_returned_; | 96 AtomicFlag join_for_testing_returned_; |
92 #endif | 97 #endif |
93 | 98 |
94 DISALLOW_COPY_AND_ASSIGN(TaskSchedulerImpl); | 99 DISALLOW_COPY_AND_ASSIGN(TaskSchedulerImpl); |
95 }; | 100 }; |
96 | 101 |
97 } // namespace internal | 102 } // namespace internal |
98 } // namespace base | 103 } // namespace base |
99 | 104 |
100 #endif // BASE_TASK_SCHEDULER_TASK_SCHEDULER_IMPL_H_ | 105 #endif // BASE_TASK_SCHEDULER_TASK_SCHEDULER_IMPL_H_ |
OLD | NEW |