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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 virtual void OnDestruct() = 0; | 159 virtual void OnDestruct() = 0; |
160 }; | 160 }; |
161 | 161 |
162 // Gets the SequencedToken of the current thread. | 162 // Gets the SequencedToken of the current thread. |
163 // If current thread is not a SequencedWorkerPool worker thread or is running | 163 // If current thread is not a SequencedWorkerPool worker thread or is running |
164 // an unsequenced task, returns an invalid SequenceToken. | 164 // an unsequenced task, returns an invalid SequenceToken. |
165 static SequenceToken GetSequenceTokenForCurrentThread(); | 165 static SequenceToken GetSequenceTokenForCurrentThread(); |
166 | 166 |
167 // Returns the SequencedWorkerPool that owns this thread, or null if the | 167 // Returns the SequencedWorkerPool that owns this thread, or null if the |
168 // current thread is not a SequencedWorkerPool worker thread. | 168 // current thread is not a SequencedWorkerPool worker thread. |
| 169 // |
| 170 // Always returns nullptr when SequencedWorkerPool is redirected to |
| 171 // TaskScheduler. |
| 172 // |
| 173 // DEPRECATED. Use SequencedTaskRunnerHandle::Get() instead. Consequentially |
| 174 // the only remaining use case is in sequenced_task_runner_handle.cc to |
| 175 // implement that and will soon be removed along with SequencedWorkerPool: |
| 176 // http://crbug.com/622400. |
169 static scoped_refptr<SequencedWorkerPool> GetWorkerPoolForCurrentThread(); | 177 static scoped_refptr<SequencedWorkerPool> GetWorkerPoolForCurrentThread(); |
170 | 178 |
171 // Returns a unique token that can be used to sequence tasks posted to | 179 // Returns a unique token that can be used to sequence tasks posted to |
172 // PostSequencedWorkerTask(). Valid tokens are always nonzero. | 180 // PostSequencedWorkerTask(). Valid tokens are always nonzero. |
173 static SequenceToken GetSequenceToken(); | 181 static SequenceToken GetSequenceToken(); |
174 | 182 |
175 // Starts redirecting tasks posted to this process' SequencedWorkerPools to | 183 // Starts redirecting tasks posted to this process' SequencedWorkerPools to |
176 // the registered TaskScheduler. This cannot be called after a task has been | 184 // the registered TaskScheduler. This cannot be called after a task has been |
177 // posted to a SequencedWorkerPool. This is not thread-safe; proper | 185 // posted to a SequencedWorkerPool. This is not thread-safe; proper |
178 // synchronization is required to use any SequencedWorkerPool method after | 186 // synchronization is required to use any SequencedWorkerPool method after |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 // Avoid pulling in too many headers by putting (almost) everything | 403 // Avoid pulling in too many headers by putting (almost) everything |
396 // into |inner_|. | 404 // into |inner_|. |
397 const std::unique_ptr<Inner> inner_; | 405 const std::unique_ptr<Inner> inner_; |
398 | 406 |
399 DISALLOW_COPY_AND_ASSIGN(SequencedWorkerPool); | 407 DISALLOW_COPY_AND_ASSIGN(SequencedWorkerPool); |
400 }; | 408 }; |
401 | 409 |
402 } // namespace base | 410 } // namespace base |
403 | 411 |
404 #endif // BASE_THREADING_SEQUENCED_WORKER_POOL_H_ | 412 #endif // BASE_THREADING_SEQUENCED_WORKER_POOL_H_ |
OLD | NEW |