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

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: review:fdoray 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') | no next file with comments »
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..3174f06d63b11369079b84791aea2fb425bd23eb 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,13 @@ 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. This is typically done during the initialization phase in each
+// process. If your code is not running in that phase, you most likely don't
+// have to worry about this. You will encounter DCHECKs or nullptr dereferences
+// if this is violated. 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') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698