| Index: base/threading/sequenced_worker_pool.h
|
| diff --git a/base/threading/sequenced_worker_pool.h b/base/threading/sequenced_worker_pool.h
|
| index f06a9e523cc530047de4d55b91f0eb745efc8566..46d228d84c2f45e4c3c513c5b9433ad765468ef0 100644
|
| --- a/base/threading/sequenced_worker_pool.h
|
| +++ b/base/threading/sequenced_worker_pool.h
|
| @@ -61,6 +61,10 @@ class SequencedTaskRunner;
|
| // 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
|
| // for CONTINUE_ON_SHUTDOWN behavior and is required for BLOCK_SHUTDOWN
|
| @@ -180,25 +184,25 @@ class BASE_EXPORT SequencedWorkerPool : public TaskRunner {
|
| // PostSequencedWorkerTask(). Valid tokens are always nonzero.
|
| static SequenceToken GetSequenceToken();
|
|
|
| - // 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.
|
| + // Enables posting tasks to this process' SequencedWorkerPools if not already
|
| + // enabled. This is not thread-safe; proper synchronization is required to use
|
| + // any SequencedWorkerPool method after calling this.
|
| + static void EnableForProcess();
|
| +
|
| + // Enables posting tasks to this process' SequencedWorkerPools with
|
| + // redirection to the registered TaskScheduler. Cannot be called if posting
|
| + // tasks to this process' SequencedWorkerPools is already enabled (with or
|
| + // without redirection to TaskScheduler). There must be a registered
|
| + // TaskScheduler when this is called.
|
| // TODO(gab): Remove this if http://crbug.com/622400 fails
|
| // (SequencedWorkerPool will be phased out completely otherwise).
|
| - 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();
|
| + 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();
|
|
|
| // When constructing a SequencedWorkerPool, there must be a
|
| // ThreadTaskRunnerHandle on the current thread unless you plan to
|
|
|