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

Unified Diff: base/task_runner_util.h

Issue 2530223002: Stop accepting a null reply in base::PostTaskAndReplyWithResult(). (Closed)
Patch Set: rebase Created 4 years, 1 month 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/task_runner_util.h
diff --git a/base/task_runner_util.h b/base/task_runner_util.h
index ba8e120c6f4393496130d9bef69a275b28533752..3b6feee753c50fea46413575a04776ae98c5bf88 100644
--- a/base/task_runner_util.h
+++ b/base/task_runner_util.h
@@ -26,12 +26,7 @@ void ReturnAsParamAdapter(const Callback<ReturnType(void)>& func,
template <typename TaskReturnType, typename ReplyArgType>
void ReplyAdapter(const Callback<void(ReplyArgType)>& callback,
TaskReturnType* result) {
- // TODO(ajwong): Remove this conditional and add a DCHECK to enforce that
- // |reply| must be non-null in PostTaskAndReplyWithResult() below after
- // current code that relies on this API softness has been removed.
- // http://crbug.com/162712
- if (!callback.is_null())
- callback.Run(std::move(*result));
+ callback.Run(std::move(*result));
}
} // namespace internal
@@ -56,6 +51,8 @@ bool PostTaskAndReplyWithResult(
const tracked_objects::Location& from_here,
const Callback<TaskReturnType(void)>& task,
const Callback<void(ReplyArgType)>& reply) {
+ DCHECK(task);
+ DCHECK(reply);
dcheng 2016/11/29 21:13:11 TIL that Callback can convert to bool.
TaskReturnType* result = new TaskReturnType();
return task_runner->PostTaskAndReply(
from_here,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698