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

Unified Diff: base/task_scheduler/post_task.cc

Issue 2726523002: Pass Callback to TaskRunner by value and consume it on invocation (1) (Closed)
Patch Set: erase Closure* Created 3 years, 9 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/scheduler_single_thread_task_runner_manager.cc » ('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 a1a3bc2da388177be2b607787e4ec9dd338f5f8e..2ed8a490c49bed9da677dbd332640d66a46a9529 100644
--- a/base/task_scheduler/post_task.cc
+++ b/base/task_scheduler/post_task.cc
@@ -21,8 +21,8 @@ class PostTaskAndReplyTaskRunner : public internal::PostTaskAndReplyImpl {
private:
bool PostTask(const tracked_objects::Location& from_here,
- const Closure& task) override {
- PostTaskWithTraits(from_here, traits_, task);
+ Closure task) override {
+ PostTaskWithTraits(from_here, traits_, std::move(task));
return true;
}
@@ -32,14 +32,14 @@ class PostTaskAndReplyTaskRunner : public internal::PostTaskAndReplyImpl {
} // namespace
-void PostTask(const tracked_objects::Location& from_here, const Closure& task) {
- PostDelayedTask(from_here, task, TimeDelta());
+void PostTask(const tracked_objects::Location& from_here, Closure task) {
+ PostDelayedTask(from_here, std::move(task), TimeDelta());
}
void PostDelayedTask(const tracked_objects::Location& from_here,
- const Closure& task,
+ Closure task,
TimeDelta delay) {
- PostDelayedTaskWithTraits(from_here, TaskTraits(), task, delay);
+ PostDelayedTaskWithTraits(from_here, TaskTraits(), std::move(task), delay);
}
void PostTaskAndReply(const tracked_objects::Location& from_here,
@@ -51,18 +51,18 @@ void PostTaskAndReply(const tracked_objects::Location& from_here,
void PostTaskWithTraits(const tracked_objects::Location& from_here,
const TaskTraits& traits,
- const Closure& task) {
- PostDelayedTaskWithTraits(from_here, traits, task, TimeDelta());
+ Closure task) {
+ PostDelayedTaskWithTraits(from_here, traits, std::move(task), TimeDelta());
}
void PostDelayedTaskWithTraits(const tracked_objects::Location& from_here,
const TaskTraits& traits,
- const Closure& task,
+ Closure task,
TimeDelta delay) {
DCHECK(TaskScheduler::GetInstance())
<< "Ref. Prerequisite section of post_task.h";
- TaskScheduler::GetInstance()->PostDelayedTaskWithTraits(from_here, traits,
- task, delay);
+ TaskScheduler::GetInstance()->PostDelayedTaskWithTraits(
+ from_here, traits, std::move(task), delay);
}
void PostTaskWithTraitsAndReply(const tracked_objects::Location& from_here,
« no previous file with comments | « base/task_scheduler/post_task.h ('k') | base/task_scheduler/scheduler_single_thread_task_runner_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698