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

Unified Diff: base/task_scheduler/post_task.cc

Issue 2678303002: Pass Callback by value on PostTaskAndReply family (Closed)
Patch Set: rebase 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/threading/post_task_and_reply_impl.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 8c3e941a303a9c874123327d470c6f1853101999..3cf075de261364c5df1f43648f3c8291cc812553 100644
--- a/base/task_scheduler/post_task.cc
+++ b/base/task_scheduler/post_task.cc
@@ -4,6 +4,8 @@
#include "base/task_scheduler/post_task.h"
+#include <utility>
+
#include "base/task_scheduler/task_scheduler.h"
#include "base/threading/post_task_and_reply_impl.h"
@@ -40,9 +42,10 @@ void PostDelayedTask(const tracked_objects::Location& from_here,
}
void PostTaskAndReply(const tracked_objects::Location& from_here,
- const Closure& task,
- const Closure& reply) {
- PostTaskWithTraitsAndReply(from_here, TaskTraits(), task, reply);
+ Closure task,
+ Closure reply) {
+ PostTaskWithTraitsAndReply(from_here, TaskTraits(), std::move(task),
+ std::move(reply));
}
void PostTaskWithTraits(const tracked_objects::Location& from_here,
@@ -61,9 +64,10 @@ void PostDelayedTaskWithTraits(const tracked_objects::Location& from_here,
void PostTaskWithTraitsAndReply(const tracked_objects::Location& from_here,
const TaskTraits& traits,
- const Closure& task,
- const Closure& reply) {
- PostTaskAndReplyTaskRunner(traits).PostTaskAndReply(from_here, task, reply);
+ Closure task,
+ Closure reply) {
+ PostTaskAndReplyTaskRunner(traits).PostTaskAndReply(
+ from_here, std::move(task), std::move(reply));
}
scoped_refptr<TaskRunner> CreateTaskRunnerWithTraits(const TaskTraits& traits) {
« no previous file with comments | « base/task_scheduler/post_task.h ('k') | base/threading/post_task_and_reply_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698