| Index: base/task_runner_util.h
|
| diff --git a/base/task_runner_util.h b/base/task_runner_util.h
|
| index 9196bf17a16f88e9992b48259ea0e22b8e0b51f8..e046f4537c2cb1a31b7aee8b86163e93cedbb77d 100644
|
| --- a/base/task_runner_util.h
|
| +++ b/base/task_runner_util.h
|
| @@ -28,22 +28,38 @@ namespace base {
|
| // PostTaskAndReplyWithResult(
|
| // target_thread_.task_runner(),
|
| // FROM_HERE,
|
| -// Bind(&DoWorkAndReturn),
|
| -// Bind(&Callback));
|
| +// BindOnce(&DoWorkAndReturn),
|
| +// BindOnce(&Callback));
|
| template <typename TaskReturnType, typename ReplyArgType>
|
| bool PostTaskAndReplyWithResult(TaskRunner* task_runner,
|
| const tracked_objects::Location& from_here,
|
| - Callback<TaskReturnType()> task,
|
| - Callback<void(ReplyArgType)> reply) {
|
| + OnceCallback<TaskReturnType()> task,
|
| + OnceCallback<void(ReplyArgType)> reply) {
|
| DCHECK(task);
|
| DCHECK(reply);
|
| TaskReturnType* result = new TaskReturnType();
|
| return task_runner->PostTaskAndReply(
|
| from_here,
|
| - base::BindOnce(&internal::ReturnAsParamAdapter<TaskReturnType>,
|
| - std::move(task), result),
|
| - base::BindOnce(&internal::ReplyAdapter<TaskReturnType, ReplyArgType>,
|
| - std::move(reply), base::Owned(result)));
|
| + BindOnce(&internal::ReturnAsParamAdapter<TaskReturnType>, std::move(task),
|
| + result),
|
| + BindOnce(&internal::ReplyAdapter<TaskReturnType, ReplyArgType>,
|
| + std::move(reply), Owned(result)));
|
| +}
|
| +
|
| +// Callback version of PostTaskAndReplyWithResult above.
|
| +// Though RepeatingCallback is convertible to OnceCallback, we need this since
|
| +// we cannot use template deduction and object conversion at once on the
|
| +// overload resolution.
|
| +// TODO(crbug.com/714018): Update all callers of the Callback version to use
|
| +// OnceCallback.
|
| +template <typename TaskReturnType, typename ReplyArgType>
|
| +bool PostTaskAndReplyWithResult(TaskRunner* task_runner,
|
| + const tracked_objects::Location& from_here,
|
| + Callback<TaskReturnType()> task,
|
| + Callback<void(ReplyArgType)> reply) {
|
| + return PostTaskAndReplyWithResult(
|
| + task_runner, from_here, OnceCallback<TaskReturnType()>(std::move(task)),
|
| + OnceCallback<void(ReplyArgType)>(std::move(reply)));
|
| }
|
|
|
| } // namespace base
|
|
|