diff options
Diffstat (limited to 'base/threading/sequenced_worker_pool.h')
-rw-r--r-- | base/threading/sequenced_worker_pool.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/base/threading/sequenced_worker_pool.h b/base/threading/sequenced_worker_pool.h index c6e0560..f5770a7 100644 --- a/base/threading/sequenced_worker_pool.h +++ b/base/threading/sequenced_worker_pool.h @@ -172,6 +172,12 @@ class BASE_EXPORT SequencedWorkerPool { const tracked_objects::Location& from_here, const base::Closure& task); + // Like PostSequencedWorkerTask above, but allows you to specify a named + // token, which saves an extra call to GetNamedSequenceToken. + bool PostNamedSequencedWorkerTask(const std::string& token_name, + const tracked_objects::Location& from_here, + const base::Closure& task); + // Same as PostSequencedWorkerTask but allows specification of the shutdown // behavior. bool PostSequencedWorkerTaskWithShutdownBehavior( @@ -180,6 +186,16 @@ class BASE_EXPORT SequencedWorkerPool { const base::Closure& task, WorkerShutdown shutdown_behavior); + // Blocks until all pending tasks are complete. This should only be called in + // unit tests when you want to validate something that should have happened. + // + // Note that calling this will not prevent other threads from posting work to + // the queue while the calling thread is waiting on Flush(). In this case, + // Flush will return only when there's no more work in the queue. Normally, + // this doesn't come up sine in a test, all the work is being posted from + // the main thread. + void FlushForTesting(); + // Implements the worker pool shutdown. This should be called during app // shutdown, and will discard/join with appropriate tasks before returning. // After this call, subsequent calls to post tasks will fail. |