OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_THREADING_SEQUENCED_WORKER_POOL_H_ | 5 #ifndef BASE_THREADING_SEQUENCED_WORKER_POOL_H_ |
6 #define BASE_THREADING_SEQUENCED_WORKER_POOL_H_ | 6 #define BASE_THREADING_SEQUENCED_WORKER_POOL_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <cstddef> | 10 #include <cstddef> |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 // Returns a unique token that can be used to sequence tasks posted to | 181 // Returns a unique token that can be used to sequence tasks posted to |
182 // PostSequencedWorkerTask(). Valid tokens are always nonzero. | 182 // PostSequencedWorkerTask(). Valid tokens are always nonzero. |
183 static SequenceToken GetSequenceToken(); | 183 static SequenceToken GetSequenceToken(); |
184 | 184 |
185 // Enables posting tasks to this process' SequencedWorkerPools. Cannot be | 185 // Enables posting tasks to this process' SequencedWorkerPools. Cannot be |
186 // called if already enabled. This is not thread-safe; proper synchronization | 186 // called if already enabled. This is not thread-safe; proper synchronization |
187 // is required to use any SequencedWorkerPool method after calling this. | 187 // is required to use any SequencedWorkerPool method after calling this. |
188 static void EnableForProcess(); | 188 static void EnableForProcess(); |
189 | 189 |
190 // Same as EnableForProcess(), but tasks are redirected to the registered | 190 // Same as EnableForProcess(), but tasks are redirected to the registered |
191 // TaskScheduler. There must be a registered TaskScheduler when this is | 191 // TaskScheduler. All redirections' TaskPriority will be capped to |
| 192 // |max_task_priority|. There must be a registered TaskScheduler when this is |
192 // called. | 193 // called. |
193 // TODO(gab): Remove this if http://crbug.com/622400 fails | 194 // TODO(gab): Remove this if http://crbug.com/622400 fails |
194 // (SequencedWorkerPool will be phased out completely otherwise). | 195 // (SequencedWorkerPool will be phased out completely otherwise). |
195 static void EnableWithRedirectionToTaskSchedulerForProcess(); | 196 static void EnableWithRedirectionToTaskSchedulerForProcess( |
| 197 TaskPriority max_task_priority = TaskPriority::HIGHEST); |
196 | 198 |
197 // Disables posting tasks to this process' SequencedWorkerPools. Calling this | 199 // Disables posting tasks to this process' SequencedWorkerPools. Calling this |
198 // while there are active SequencedWorkerPools is not supported. This is not | 200 // while there are active SequencedWorkerPools is not supported. This is not |
199 // thread-safe; proper synchronization is required to use any | 201 // thread-safe; proper synchronization is required to use any |
200 // SequencedWorkerPool method after calling this. | 202 // SequencedWorkerPool method after calling this. |
201 static void DisableForProcessForTesting(); | 203 static void DisableForProcessForTesting(); |
202 | 204 |
203 // Returns true if posting tasks to this process' SequencedWorkerPool is | 205 // Returns true if posting tasks to this process' SequencedWorkerPool is |
204 // enabled (with or without redirection to TaskScheduler). | 206 // enabled (with or without redirection to TaskScheduler). |
205 static bool IsEnabled(); | 207 static bool IsEnabled(); |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 // Avoid pulling in too many headers by putting (almost) everything | 409 // Avoid pulling in too many headers by putting (almost) everything |
408 // into |inner_|. | 410 // into |inner_|. |
409 const std::unique_ptr<Inner> inner_; | 411 const std::unique_ptr<Inner> inner_; |
410 | 412 |
411 DISALLOW_COPY_AND_ASSIGN(SequencedWorkerPool); | 413 DISALLOW_COPY_AND_ASSIGN(SequencedWorkerPool); |
412 }; | 414 }; |
413 | 415 |
414 } // namespace base | 416 } // namespace base |
415 | 417 |
416 #endif // BASE_THREADING_SEQUENCED_WORKER_POOL_H_ | 418 #endif // BASE_THREADING_SEQUENCED_WORKER_POOL_H_ |
OLD | NEW |