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

Unified Diff: base/threading/sequenced_worker_pool.h

Issue 18231002: base: Change WeakPtr to use SequenceChecker instead of ThreadChecker. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix death tests on ios. Created 7 years, 6 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
« no previous file with comments | « base/sequence_checker_unittest.cc ('k') | base/threading/sequenced_worker_pool.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/threading/sequenced_worker_pool.h
diff --git a/base/threading/sequenced_worker_pool.h b/base/threading/sequenced_worker_pool.h
index 7e04b071428c838dfcec0faa647f82baf2932045..fa3fa7a99f311d1b4aa78f558fab0267c1f86519 100644
--- a/base/threading/sequenced_worker_pool.h
+++ b/base/threading/sequenced_worker_pool.h
@@ -143,6 +143,9 @@ class BASE_EXPORT SequencedWorkerPool : public TaskRunner {
virtual void OnDestruct() = 0;
};
+ // Gets the SequencedWorkerPool for the current thread. Result may be NULL.
+ static SequencedWorkerPool* Current();
akalin 2013/06/28 23:32:00 i don't really like exposing this. seems better to
tommycli 2013/06/28 23:49:49 Since SequencedWorkerPool is not enforced to be a
+
// When constructing a SequencedWorkerPool, there must be a
// MessageLoop on the current thread unless you plan to deliberately
// leak it.
@@ -159,7 +162,7 @@ class BASE_EXPORT SequencedWorkerPool : public TaskRunner {
TestingObserver* observer);
// 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
@@ -168,6 +171,11 @@ class BASE_EXPORT SequencedWorkerPool : public TaskRunner {
// will be created.
SequenceToken GetNamedSequenceToken(const std::string& name);
+ // Retrieves the sequence token associated with the current thread.
+ // If current thread is not part in worker pool, this returns false and
+ // |result_token| is unmodified. |result_token| may not be NULL.
+ bool GetCurrentThreadSequenceToken(SequenceToken* result_token) const;
+
// Returns a SequencedTaskRunner wrapper which posts to this
// SequencedWorkerPool using the given sequence token. Tasks with nonzero
// delay are posted with SKIP_ON_SHUTDOWN behavior and tasks with zero delay
« no previous file with comments | « base/sequence_checker_unittest.cc ('k') | base/threading/sequenced_worker_pool.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698