Chromium Code Reviews| Index: base/task_scheduler/post_task.h |
| diff --git a/base/task_scheduler/post_task.h b/base/task_scheduler/post_task.h |
| index 1c5c7096b5c1e4e21ffdab0ff16ac4535de9fdc7..567d32691d022adc211af71dbe05acc55be5b36f 100644 |
| --- a/base/task_scheduler/post_task.h |
| +++ b/base/task_scheduler/post_task.h |
| @@ -7,7 +7,7 @@ |
| #include "base/base_export.h" |
| #include "base/bind.h" |
| -#include "base/callback_forward.h" |
| +#include "base/callback.h" |
| #include "base/location.h" |
| #include "base/memory/ref_counted.h" |
| #include "base/post_task_and_reply_with_result_internal.h" |
| @@ -81,8 +81,8 @@ BASE_EXPORT void PostDelayedTask(const tracked_objects::Location& from_here, |
| // PostTaskWithTraitsAndReply with plain TaskTraits. Can only be called when |
| // SequencedTaskRunnerHandle::IsSet(). |
| BASE_EXPORT void PostTaskAndReply(const tracked_objects::Location& from_here, |
| - const Closure& task, |
| - const Closure& reply); |
| + Closure task, |
| + Closure reply); |
| // Posts |task| to the TaskScheduler and posts |reply| with the return value of |
| // |task| as argument on the caller's execution context (i.e. same sequence or |
| @@ -91,9 +91,10 @@ BASE_EXPORT void PostTaskAndReply(const tracked_objects::Location& from_here, |
| // TaskTraits. Can only be called when SequencedTaskRunnerHandle::IsSet(). |
| template <typename TaskReturnType, typename ReplyArgType> |
| void PostTaskAndReplyWithResult(const tracked_objects::Location& from_here, |
| - const Callback<TaskReturnType(void)>& task, |
| - const Callback<void(ReplyArgType)>& reply) { |
| - PostTaskWithTraitsAndReplyWithResult(from_here, TaskTraits(), task, reply); |
| + Callback<TaskReturnType(void)> task, |
| + Callback<void(ReplyArgType)> reply) { |
| + PostTaskWithTraitsAndReplyWithResult(from_here, TaskTraits(), std::move(task), |
| + std::move(reply)); |
|
gab
2017/02/07 15:46:08
#include <utility>
tzik
2017/02/08 01:39:32
Done.
|
| } |
| // Posts |task| with specific |traits| to the TaskScheduler. |
| @@ -119,8 +120,8 @@ BASE_EXPORT void PostDelayedTaskWithTraits( |
| BASE_EXPORT void PostTaskWithTraitsAndReply( |
| const tracked_objects::Location& from_here, |
| const TaskTraits& traits, |
| - const Closure& task, |
| - const Closure& reply); |
| + Closure task, |
| + Closure reply); |
| // Posts |task| with specific |traits| to the TaskScheduler and posts |reply| |
| // with the return value of |task| as argument on the caller's execution context |
| @@ -130,14 +131,14 @@ template <typename TaskReturnType, typename ReplyArgType> |
| void PostTaskWithTraitsAndReplyWithResult( |
| const tracked_objects::Location& from_here, |
| const TaskTraits& traits, |
| - const Callback<TaskReturnType(void)>& task, |
| - const Callback<void(ReplyArgType)>& reply) { |
| + Callback<TaskReturnType()> task, |
| + Callback<void(ReplyArgType)> reply) { |
| TaskReturnType* result = new TaskReturnType(); |
| return PostTaskWithTraitsAndReply( |
| - from_here, traits, |
| - Bind(&internal::ReturnAsParamAdapter<TaskReturnType>, task, result), |
| - Bind(&internal::ReplyAdapter<TaskReturnType, ReplyArgType>, reply, |
| - Owned(result))); |
| + from_here, traits, Bind(&internal::ReturnAsParamAdapter<TaskReturnType>, |
| + std::move(task), result), |
| + Bind(&internal::ReplyAdapter<TaskReturnType, ReplyArgType>, |
| + std::move(reply), Owned(result))); |
| } |
| // Returns a TaskRunner whose PostTask invocations result in scheduling tasks |