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_H_ | 5 #ifndef BASE_TASK_SCHEDULER_TASK_SCHEDULER_H_ |
6 #define BASE_TASK_SCHEDULER_TASK_SCHEDULER_H_ | 6 #define BASE_TASK_SCHEDULER_TASK_SCHEDULER_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 // scheduling tasks using |traits|. Tasks run one at a time in posting order. | 88 // scheduling tasks using |traits|. Tasks run one at a time in posting order. |
89 virtual scoped_refptr<SequencedTaskRunner> | 89 virtual scoped_refptr<SequencedTaskRunner> |
90 CreateSequencedTaskRunnerWithTraits(const TaskTraits& traits) = 0; | 90 CreateSequencedTaskRunnerWithTraits(const TaskTraits& traits) = 0; |
91 | 91 |
92 // Returns a SingleThreadTaskRunner whose PostTask invocations result in | 92 // Returns a SingleThreadTaskRunner whose PostTask invocations result in |
93 // scheduling tasks using |traits|. Tasks run on a single thread in posting | 93 // scheduling tasks using |traits|. Tasks run on a single thread in posting |
94 // order. | 94 // order. |
95 virtual scoped_refptr<SingleThreadTaskRunner> | 95 virtual scoped_refptr<SingleThreadTaskRunner> |
96 CreateSingleThreadTaskRunnerWithTraits( | 96 CreateSingleThreadTaskRunnerWithTraits( |
97 const TaskTraits& traits, | 97 const TaskTraits& traits, |
98 SingleThreadTaskRunnerThreadMode thread_mode = | 98 SingleThreadTaskRunnerThreadMode thread_mode) = 0; |
99 SingleThreadTaskRunnerThreadMode::SHARED) = 0; | |
100 | 99 |
101 #if defined(OS_WIN) | 100 #if defined(OS_WIN) |
102 // Returns a SingleThreadTaskRunner whose PostTask invocations result in | 101 // Returns a SingleThreadTaskRunner whose PostTask invocations result in |
103 // scheduling tasks using |traits| in a COM Single-Threaded Apartment. Tasks | 102 // scheduling tasks using |traits| in a COM Single-Threaded Apartment. Tasks |
104 // run in the same Single-Threaded Apartment in posting order for the returned | 103 // run in the same Single-Threaded Apartment in posting order for the returned |
105 // SingleThreadTaskRunner. There is not necessarily a one-to-one | 104 // SingleThreadTaskRunner. There is not necessarily a one-to-one |
106 // correspondence between SingleThreadTaskRunners and Single-Threaded | 105 // correspondence between SingleThreadTaskRunners and Single-Threaded |
107 // Apartments. The implementation is free to share apartments or create new | 106 // Apartments. The implementation is free to share apartments or create new |
108 // apartments as necessary. In either case, care should be taken to make sure | 107 // apartments as necessary. In either case, care should be taken to make sure |
109 // COM pointers are not smuggled across apartments. | 108 // COM pointers are not smuggled across apartments. |
110 virtual scoped_refptr<SingleThreadTaskRunner> | 109 virtual scoped_refptr<SingleThreadTaskRunner> |
111 CreateCOMSTATaskRunnerWithTraits( | 110 CreateCOMSTATaskRunnerWithTraits( |
112 const TaskTraits& traits, | 111 const TaskTraits& traits, |
113 SingleThreadTaskRunnerThreadMode thread_mode = | 112 SingleThreadTaskRunnerThreadMode thread_mode) = 0; |
114 SingleThreadTaskRunnerThreadMode::SHARED) = 0; | |
115 #endif // defined(OS_WIN) | 113 #endif // defined(OS_WIN) |
116 | 114 |
117 // Returns a vector of all histograms available in this task scheduler. | 115 // Returns a vector of all histograms available in this task scheduler. |
118 virtual std::vector<const HistogramBase*> GetHistograms() const = 0; | 116 virtual std::vector<const HistogramBase*> GetHistograms() const = 0; |
119 | 117 |
120 // Synchronously shuts down the scheduler. Once this is called, only tasks | 118 // Synchronously shuts down the scheduler. Once this is called, only tasks |
121 // posted with the BLOCK_SHUTDOWN behavior will be run. When this returns: | 119 // posted with the BLOCK_SHUTDOWN behavior will be run. When this returns: |
122 // - All SKIP_ON_SHUTDOWN tasks that were already running have completed their | 120 // - All SKIP_ON_SHUTDOWN tasks that were already running have completed their |
123 // execution. | 121 // execution. |
124 // - All posted BLOCK_SHUTDOWN tasks have completed their execution. | 122 // - All posted BLOCK_SHUTDOWN tasks have completed their execution. |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 // each process n/GetMaxConcurrentTasksWithTraitsDeprecated() items. | 201 // each process n/GetMaxConcurrentTasksWithTraitsDeprecated() items. |
204 // | 202 // |
205 // TODO(fdoray): Remove this method. https://crbug.com/687264 | 203 // TODO(fdoray): Remove this method. https://crbug.com/687264 |
206 virtual int GetMaxConcurrentTasksWithTraitsDeprecated( | 204 virtual int GetMaxConcurrentTasksWithTraitsDeprecated( |
207 const TaskTraits& traits) const = 0; | 205 const TaskTraits& traits) const = 0; |
208 }; | 206 }; |
209 | 207 |
210 } // namespace base | 208 } // namespace base |
211 | 209 |
212 #endif // BASE_TASK_SCHEDULER_TASK_SCHEDULER_H_ | 210 #endif // BASE_TASK_SCHEDULER_TASK_SCHEDULER_H_ |
OLD | NEW |