Chromium Code Reviews| Index: base/threading/sequenced_worker_pool.h |
| =================================================================== |
| --- base/threading/sequenced_worker_pool.h (revision 116825) |
| +++ base/threading/sequenced_worker_pool.h (working copy) |
| @@ -172,6 +172,12 @@ |
| 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 @@ |
| 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 callin this will not prevent other threads from posting work to |
|
jam
2012/01/08 23:04:23
nit: calling
|
| + // 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 Flush(); |
|
jam
2012/01/08 23:04:23
if this is only for testing, can we call this Flus
|
| + |
| // 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. |