Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(430)

Unified Diff: base/threading/sequenced_worker_pool.h

Issue 9663075: Implementation of SequencedTaskRunner based on SequencedWorkerPool. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: base/threading/sequenced_worker_pool.h
===================================================================
--- base/threading/sequenced_worker_pool.h (revision 126348)
+++ base/threading/sequenced_worker_pool.h (working copy)
@@ -26,12 +26,15 @@
template <class T> class DeleteHelper;
+class SequencedTaskRunner;
+
// A worker thread pool that enforces ordering between sets of tasks. It also
// allows you to specify what should happen to your tasks on shutdown.
//
// To enforce ordering, get a unique sequence token from the pool and post all
// tasks you want to order with the token. All tasks with the same token are
-// guaranteed to execute serially, though not necessarily on the same thread.
+// guaranteed to execute serially (i.e. there is no execution overlap
+// whatsoever), though not necessarily on the same thread.
//
// Example:
// SequencedWorkerPool::SequenceToken token = pool.GetSequenceToken();
@@ -132,7 +135,7 @@
const std::string& thread_name_prefix);
// Returns a unique token that can be used to sequence tasks posted to
- // PostSequencedWorkerTask(). Valid tokens are alwys nonzero.
+ // PostSequencedWorkerTask(). Valid tokens are always nonzero.
SequenceToken GetSequenceToken();
// Returns the sequence token associated with the given name. Calling this
@@ -141,6 +144,13 @@
// will be created.
SequenceToken GetNamedSequenceToken(const std::string& name);
+ // Returns a SequencedTaskRunner wrapper for this SequencedWorkerPool.
+ scoped_refptr<SequencedTaskRunner> GetSequencedTaskRunner();
+ scoped_refptr<SequencedTaskRunner> GetSequencedTaskRunner(
+ SequenceToken token);
+ scoped_refptr<SequencedTaskRunner> GetSequencedTaskRunner(
+ const std::string& token_name);
+
// Posts the given task for execution in the worker pool. Tasks posted with
// this function will execute in an unspecified order on a background thread.
// Returns true if the task was posted. If your tasks have ordering

Powered by Google App Engine
This is Rietveld 408576698