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. The only remaining use is in | |
danakj
2016/09/30 19:14:55
Can you say what people should use instead?
gab
2016/09/30 19:24:01
IMO something like:
// DEPRECATED. Use SequencedT
fdoray
2016/09/30 19:28:55
Done.
| |
174 // base/threading/sequenced_task_runner_handle.cc. | |
169 static scoped_refptr<SequencedWorkerPool> GetWorkerPoolForCurrentThread(); | 175 static scoped_refptr<SequencedWorkerPool> GetWorkerPoolForCurrentThread(); |
170 | 176 |
171 // Returns a unique token that can be used to sequence tasks posted to | 177 // Returns a unique token that can be used to sequence tasks posted to |
172 // PostSequencedWorkerTask(). Valid tokens are always nonzero. | 178 // PostSequencedWorkerTask(). Valid tokens are always nonzero. |
173 static SequenceToken GetSequenceToken(); | 179 static SequenceToken GetSequenceToken(); |
174 | 180 |
175 // Starts redirecting tasks posted to this process' SequencedWorkerPools to | 181 // Starts redirecting tasks posted to this process' SequencedWorkerPools to |
176 // the registered TaskScheduler. This cannot be called after a task has been | 182 // the registered TaskScheduler. This cannot be called after a task has been |
177 // posted to a SequencedWorkerPool. This is not thread-safe; proper | 183 // posted to a SequencedWorkerPool. This is not thread-safe; proper |
178 // synchronization is required to use any SequencedWorkerPool method after | 184 // 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 | 401 // Avoid pulling in too many headers by putting (almost) everything |
396 // into |inner_|. | 402 // into |inner_|. |
397 const std::unique_ptr<Inner> inner_; | 403 const std::unique_ptr<Inner> inner_; |
398 | 404 |
399 DISALLOW_COPY_AND_ASSIGN(SequencedWorkerPool); | 405 DISALLOW_COPY_AND_ASSIGN(SequencedWorkerPool); |
400 }; | 406 }; |
401 | 407 |
402 } // namespace base | 408 } // namespace base |
403 | 409 |
404 #endif // BASE_THREADING_SEQUENCED_WORKER_POOL_H_ | 410 #endif // BASE_THREADING_SEQUENCED_WORKER_POOL_H_ |
OLD | NEW |