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

Unified Diff: base/task_scheduler/task_scheduler.h

Issue 2834063002: Separate the create and start phases in TaskSchedulerImpl. (Closed)
Patch Set: self-review Created 3 years, 8 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
Index: base/task_scheduler/task_scheduler.h
diff --git a/base/task_scheduler/task_scheduler.h b/base/task_scheduler/task_scheduler.h
index 9c7207ef0b550858941960135d39eb8a8baa1628..fa786c88efe7580a8193edb0ac0020fdb26e1c68 100644
--- a/base/task_scheduler/task_scheduler.h
+++ b/base/task_scheduler/task_scheduler.h
@@ -33,9 +33,17 @@ namespace base {
class HistogramBase;
// Interface for a task scheduler and static methods to manage the instance used
-// by the post_task.h API. Note: all base/task_scheduler users should go through
-// post_task.h instead of TaskScheduler except for the one callsite per process
-// which manages the process' instance.
+// by the post_task.h API.
+//
+// The task scheduler doesn't create threads before Start() is called. Tasks can
+// be posted before Start() is called, but they don't run until Start() is
+// called.
+//
+// The non-static methods of this class are thread-safe.
robliao 2017/04/24 22:32:19 Nit: non-static -> instance
fdoray 2017/04/25 18:43:34 Done.
+//
+// Note: all base/task_scheduler users should go through post_task.h instead of
robliao 2017/04/24 22:32:19 Nit: all -> All
gab 2017/04/25 15:16:15 I don't think this is required (and IMO capital le
robliao 2017/04/25 17:37:28 http://apvschicago.com/2011/04/capitalization-afte
fdoray 2017/04/25 18:43:34 Done.
+// TaskScheduler except for the one callsite per process which manages the
+// process' instance.
robliao 2017/04/24 22:32:19 Nit: process's
gab 2017/04/25 15:16:15 Don't think this is required either (I sure always
robliao 2017/04/25 17:37:27 In this case, because process is singular, process
fdoray 2017/04/25 18:43:34 Done.
class BASE_EXPORT TaskScheduler {
public:
struct BASE_EXPORT InitParams {
@@ -59,6 +67,10 @@ class BASE_EXPORT TaskScheduler {
// returned.
virtual ~TaskScheduler() = default;
+ // Allows the task scheduler to create threads and run tasks following the
+ // |init_params| specification. CHECKs on failure.
+ virtual void Start(const InitParams& init_params) = 0;
+
// Posts |task| with a |delay| and specific |traits|. |delay| can be zero.
// For one off tasks that don't require a TaskRunner.
virtual void PostDelayedTaskWithTraits(

Powered by Google App Engine
This is Rietveld 408576698