Index: base/task_scheduler/task_scheduler.h |
diff --git a/base/task_scheduler/task_scheduler.h b/base/task_scheduler/task_scheduler.h |
index fa786c88efe7580a8193edb0ac0020fdb26e1c68..8dc77ccdecd03f6c2e38eb054e2e2c227a8c69f7 100644 |
--- a/base/task_scheduler/task_scheduler.h |
+++ b/base/task_scheduler/task_scheduler.h |
@@ -135,28 +135,35 @@ class BASE_EXPORT TaskScheduler { |
// after this call. |
virtual void JoinForTesting() = 0; |
- // CreateAndSetSimpleTaskScheduler(), CreateAndSetDefaultTaskScheduler(), and |
- // SetInstance() register a TaskScheduler to handle tasks posted through the |
- // post_task.h API for this process. The registered TaskScheduler will only be |
- // deleted when a new TaskScheduler is registered and is leaked on shutdown. |
- // The methods must not be called when TaskRunners created by the previous |
- // TaskScheduler are still alive. The methods are not thread-safe; proper |
- // synchronization is required to use the post_task.h API after registering a |
- // new TaskScheduler. |
+// CreateAndStartWithDefaultParams(), Create(), and SetInstance() register a |
robliao
2017/04/24 22:37:27
Discuss when one would use Create vs CreateAndStar
fdoray
2017/04/25 21:56:11
Done.
|
+// TaskScheduler to handle tasks posted through the post_task.h API for this |
+// process. The registered TaskScheduler will only be deleted when a new |
+// TaskScheduler is registered and is leaked on shutdown. The methods must not |
+// be called when TaskRunners created by the previous TaskScheduler are still |
+// alive. The methods are not thread-safe; proper synchronization is required to |
+// use the post_task.h API after registering a new TaskScheduler. |
#if !defined(OS_NACL) |
- // Creates and sets a task scheduler using default params. |name| is used to |
+ // Creates and starts a task scheduler using default params. |name| is used to |
// label threads and histograms. It should identify the component that calls |
- // this. CHECKs on failure. For tests, prefer base::test::ScopedTaskScheduler |
- // (ensures isolation). |
+ // this. Start() is called by this method; it is invalid to call it again |
+ // afterwards. CHECKs on failure. For tests, prefer |
+ // base::test::ScopedTaskEnvironment (ensures isolation). |
+ static void CreateAndStartWithDefaultParams(StringPiece name); |
+ |
+ // Deprecated. |
static void CreateAndSetSimpleTaskScheduler(StringPiece name); |
#endif // !defined(OS_NACL) |
- // Creates and sets a task scheduler using custom params. |name| is used to |
- // label threads and histograms. It should identify the component that creates |
- // the TaskScheduler. |init_params| is used to initialize the worker pools. |
- // CHECKs on failure. For tests, prefer base::test::ScopedTaskScheduler |
- // (ensures isolation). |
+ // Creates a task scheduler. |name| is used to label threads and histograms. |
robliao
2017/04/24 22:37:27
Creates a ready to start task scheduler.
fdoray
2017/04/25 21:56:10
Done.
|
+ // It should identify the component that creates the TaskScheduler. The task |
+ // scheduler doesn't create threads until Start() is called on |
+ // TaskScheduler::GetInstance(). Tasks can be posted before Start() is called, |
+ // but they don't run until Start() is called. For tests, prefer |
+ // base::test::ScopedTaskEnvironment (ensures isolation). |
+ static void Create(StringPiece name); |
+ |
+ // Deprecated. |
static void CreateAndSetDefaultTaskScheduler(StringPiece name, |
const InitParams& init_params); |