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

Unified Diff: base/task_scheduler/post_task.cc

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 | « base/task_scheduler/post_task.h ('k') | base/task_scheduler/task_scheduler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/task_scheduler/post_task.cc
diff --git a/base/task_scheduler/post_task.cc b/base/task_scheduler/post_task.cc
index 3cf075de261364c5df1f43648f3c8291cc812553..a1a3bc2da388177be2b607787e4ec9dd338f5f8e 100644
--- a/base/task_scheduler/post_task.cc
+++ b/base/task_scheduler/post_task.cc
@@ -6,6 +6,7 @@
#include <utility>
+#include "base/logging.h"
#include "base/task_scheduler/task_scheduler.h"
#include "base/threading/post_task_and_reply_impl.h"
@@ -58,6 +59,8 @@ void PostDelayedTaskWithTraits(const tracked_objects::Location& from_here,
const TaskTraits& traits,
const Closure& task,
TimeDelta delay) {
+ DCHECK(TaskScheduler::GetInstance())
+ << "Ref. Prerequisite section of post_task.h";
TaskScheduler::GetInstance()->PostDelayedTaskWithTraits(from_here, traits,
task, delay);
}
@@ -71,17 +74,23 @@ void PostTaskWithTraitsAndReply(const tracked_objects::Location& from_here,
}
scoped_refptr<TaskRunner> CreateTaskRunnerWithTraits(const TaskTraits& traits) {
+ DCHECK(TaskScheduler::GetInstance())
+ << "Ref. Prerequisite section of post_task.h";
return TaskScheduler::GetInstance()->CreateTaskRunnerWithTraits(traits);
}
scoped_refptr<SequencedTaskRunner> CreateSequencedTaskRunnerWithTraits(
const TaskTraits& traits) {
+ DCHECK(TaskScheduler::GetInstance())
+ << "Ref. Prerequisite section of post_task.h";
return TaskScheduler::GetInstance()->CreateSequencedTaskRunnerWithTraits(
traits);
}
scoped_refptr<SingleThreadTaskRunner> CreateSingleThreadTaskRunnerWithTraits(
const TaskTraits& traits) {
+ DCHECK(TaskScheduler::GetInstance())
+ << "Ref. Prerequisite section of post_task.h";
return TaskScheduler::GetInstance()->CreateSingleThreadTaskRunnerWithTraits(
traits);
}
« no previous file with comments | « base/task_scheduler/post_task.h ('k') | base/task_scheduler/task_scheduler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698