Index: base/threading/sequenced_worker_pool.h |
diff --git a/base/threading/sequenced_worker_pool.h b/base/threading/sequenced_worker_pool.h |
index 9369fb7adea535ea262a41ffe3850f133eddcb97..a85eb4d3d84ce8486244275c2fc0599c860cb0af 100644 |
--- a/base/threading/sequenced_worker_pool.h |
+++ b/base/threading/sequenced_worker_pool.h |
@@ -45,7 +45,8 @@ class SequencedTaskRunner; |
// destruction will be visible to T2. |
// |
// Example: |
-// SequencedWorkerPool::SequenceToken token = pool.GetSequenceToken(); |
+// SequencedWorkerPool::SequenceToken token = |
+// SequencedWorkerPool::GetSequenceToken(); |
// pool.PostSequencedWorkerTask(token, SequencedWorkerPool::SKIP_ON_SHUTDOWN, |
// FROM_HERE, base::Bind(...)); |
// pool.PostSequencedWorkerTask(token, SequencedWorkerPool::SKIP_ON_SHUTDOWN, |
@@ -161,9 +162,12 @@ class BASE_EXPORT SequencedWorkerPool : public TaskRunner { |
// an unsequenced task, returns an invalid SequenceToken. |
static SequenceToken GetSequenceTokenForCurrentThread(); |
- // Returns the SequencedWorkerPool that owns this thread, or null if the |
- // current thread is not a SequencedWorkerPool worker thread. |
- static scoped_refptr<SequencedWorkerPool> GetWorkerPoolForCurrentThread(); |
+ // Gets a SequencedTaskRunner for the current thread. If the current thread is |
+ // running an unsequenced task, a new SequenceToken will be generated and set, |
+ // so that the returned SequencedTaskRunner is guaranteed to run tasks after |
+ // the current task has finished running. |
+ static scoped_refptr<SequencedTaskRunner> |
+ GetSequencedTaskRunnerForCurrentThread(); |
// When constructing a SequencedWorkerPool, there must be a |
// ThreadTaskRunnerHandle on the current thread unless you plan to |
@@ -182,7 +186,7 @@ class BASE_EXPORT SequencedWorkerPool : public TaskRunner { |
// Returns a unique token that can be used to sequence tasks posted to |
// PostSequencedWorkerTask(). Valid tokens are always nonzero. |
- SequenceToken GetSequenceToken(); |
+ static SequenceToken GetSequenceToken(); |
danakj
2015/11/17 22:03:39
can you move this beside other static methods (Get
Bernhard Bauer
2015/11/18 13:15:50
Moved it. The method is currently used in 67 place
|
// Returns the sequence token associated with the given name. Calling this |
// function multiple times with the same string will always produce the |