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

Unified Diff: base/threading/sequenced_worker_pool.h

Issue 2517443002: Revert of Disallow posting tasks to SequencedWorkerPools by default. (Closed)
Patch Set: Created 4 years, 1 month 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/test/test_suite.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 f1070d573b4c36c12fc5b4d731e074ffe96a0736..252d511d3f2bae0f09738c0939d0d2932dc10877 100644
--- a/base/threading/sequenced_worker_pool.h
+++ b/base/threading/sequenced_worker_pool.h
@@ -58,10 +58,6 @@
// You can also post tasks to the pool without ordering using PostWorkerTask.
// These will be executed in an unspecified order. The order of execution
// between tasks with different sequence tokens is also unspecified.
-//
-// You must call EnableForProcess() or
-// EnableWithRedirectionToTaskSchedulerForProcess() before starting to post
-// tasks to a process' SequencedWorkerPools.
//
// This class may be leaked on shutdown to facilitate fast shutdown. The
// expected usage, however, is to call Shutdown(), which correctly accounts
@@ -182,27 +178,25 @@
// PostSequencedWorkerTask(). Valid tokens are always nonzero.
static SequenceToken GetSequenceToken();
- // Enables posting tasks to this process' SequencedWorkerPools. Cannot be
- // called if already enabled. This is not thread-safe; proper synchronization
- // is required to use any SequencedWorkerPool method after calling this.
- static void EnableForProcess();
-
- // Same as EnableForProcess(), but tasks are redirected to the registered
- // TaskScheduler. There must be a registered TaskScheduler when this is
- // called.
+ // Starts redirecting tasks posted to this process' SequencedWorkerPools to
+ // the registered TaskScheduler. This cannot be called after a task has been
+ // posted to a SequencedWorkerPool. This is not thread-safe; proper
+ // synchronization is required to use any SequencedWorkerPool method after
+ // calling this. There must be a registered TaskScheduler when this is called.
+ // Ideally, call this on the main thread of a process, before any other
+ // threads are created and before any tasks are posted to that process'
+ // SequencedWorkerPools.
// TODO(gab): Remove this if http://crbug.com/622400 fails
// (SequencedWorkerPool will be phased out completely otherwise).
- static void EnableWithRedirectionToTaskSchedulerForProcess();
-
- // Disables posting tasks to this process' SequencedWorkerPools. Calling this
- // while there are active SequencedWorkerPools is not supported. This is not
- // thread-safe; proper synchronization is required to use any
- // SequencedWorkerPool method after calling this.
- static void DisableForProcessForTesting();
-
- // Returns true if posting tasks to this process' SequencedWorkerPool is
- // enabled (with or without redirection to TaskScheduler).
- static bool IsEnabled();
+ static void RedirectToTaskSchedulerForProcess();
+
+ // Stops redirecting tasks posted to this process' SequencedWorkerPools to the
+ // registered TaskScheduler and allows RedirectToTaskSchedulerForProcess() to
+ // be called even if tasks have already posted to a SequencedWorkerPool in
+ // this process. Calling this while there are active SequencedWorkerPools is
+ // not supported. This is not thread-safe; proper synchronization is required
+ // to use any SequencedWorkerPool method after calling this.
+ static void ResetRedirectToTaskSchedulerForProcessForTesting();
// When constructing a SequencedWorkerPool, there must be a
// ThreadTaskRunnerHandle on the current thread unless you plan to
« no previous file with comments | « base/test/test_suite.cc ('k') | base/threading/sequenced_worker_pool.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698