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

Unified Diff: base/task_scheduler/post_task.h

Issue 2709163006: Update TaskScheduler docs to make it more obvious how a TaskScheduler should be put in place. (Closed)
Patch Set: Created 3 years, 10 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 | « no previous file | base/task_scheduler/post_task.cc » ('j') | base/task_scheduler/post_task.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/task_scheduler/post_task.h
diff --git a/base/task_scheduler/post_task.h b/base/task_scheduler/post_task.h
index 8b3e7dfa05b56a7757625f3cec75486ba4401f97..caa100a2605dec1948065f697e64d7b9b15d088a 100644
--- a/base/task_scheduler/post_task.h
+++ b/base/task_scheduler/post_task.h
@@ -23,9 +23,6 @@ namespace base {
// This is the preferred interface to post tasks to the TaskScheduler.
//
-// TaskScheduler must have been registered for the current process via
-// TaskScheduler::SetInstance() before the functions below are valid.
-//
// To post a simple one-off task with default traits:
// PostTask(FROM_HERE, Bind(...));
//
@@ -62,6 +59,14 @@ namespace base {
// registered TaskScheduler (i.e. not on the main thread). Tasks posted through
// functions below with a delay may be coalesced (i.e. delays may be adjusted to
// reduce the number of wakeups and hence power consumption).
+//
+// Prerequisite: A TaskScheduler must have been registered for the current
+// process via TaskScheduler::SetInstance() before the functions below are
+// valid. Note: this is typically done in the main of each process and you most
robliao 2017/02/23 23:00:33 Omit "Note:" Maybe This is typically done during
gab 2017/02/23 23:39:57 Done and also documented GetInstance() further to
+// likely don't have to worry about this if you're not in charge of the main for
+// your process (the failure mode isn't subtle either -- DCHECK or nullptr
+// crash -- so you'll find out quickly if this isn't the case). For tests,
+// prefer base::test::ScopedTaskScheduler.
// Posts |task| to the TaskScheduler. Calling this is equivalent to calling
// PostTaskWithTraits with plain TaskTraits.
« no previous file with comments | « no previous file | base/task_scheduler/post_task.cc » ('j') | base/task_scheduler/post_task.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698