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

Unified Diff: base/task_scheduler/post_task.cc

Issue 2122543002: Replace Closure in TaskRunner::PostTask with OneShotCallback (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@07_oneshot
Patch Set: fix Created 4 years, 3 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_worker.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 f415cd3800b555a3d34980660a57eb77eef5353a..5594e9963d2585717e31418224bfe7f98744bbec 100644
--- a/base/task_scheduler/post_task.cc
+++ b/base/task_scheduler/post_task.cc
@@ -4,6 +4,7 @@
#include "base/task_scheduler/post_task.h"
+#include "base/callback.h"
#include "base/task_scheduler/task_scheduler.h"
#include "base/threading/post_task_and_reply_impl.h"
@@ -18,8 +19,8 @@ class PostTaskAndReplyTaskRunner : public internal::PostTaskAndReplyImpl {
private:
bool PostTask(const tracked_objects::Location& from_here,
- const Closure& task) override {
- PostTaskWithTraits(from_here, traits_, task);
+ OnceClosure task) override {
+ PostTaskWithTraits(from_here, traits_, std::move(task));
return true;
}
@@ -29,27 +30,30 @@ class PostTaskAndReplyTaskRunner : public internal::PostTaskAndReplyImpl {
} // namespace
-void PostTask(const tracked_objects::Location& from_here, const Closure& task) {
- PostTaskWithTraits(from_here, TaskTraits(), task);
+void PostTask(const tracked_objects::Location& from_here, OnceClosure task) {
+ PostTaskWithTraits(from_here, TaskTraits(), std::move(task));
}
void PostTaskAndReply(const tracked_objects::Location& from_here,
- const Closure& task,
- const Closure& reply) {
- PostTaskWithTraitsAndReply(from_here, TaskTraits(), task, reply);
+ OnceClosure task,
+ OnceClosure reply) {
+ PostTaskWithTraitsAndReply(from_here, TaskTraits(),
+ std::move(task), std::move(reply));
}
void PostTaskWithTraits(const tracked_objects::Location& from_here,
TaskTraits traits,
- const Closure& task) {
- TaskScheduler::GetInstance()->PostTaskWithTraits(from_here, traits, task);
+ OnceClosure task) {
+ TaskScheduler::GetInstance()->PostTaskWithTraits(from_here, traits,
+ std::move(task));
}
void PostTaskWithTraitsAndReply(const tracked_objects::Location& from_here,
TaskTraits traits,
- const Closure& task,
- const Closure& reply) {
- PostTaskAndReplyTaskRunner(traits).PostTaskAndReply(from_here, task, reply);
+ OnceClosure task,
+ OnceClosure reply) {
+ PostTaskAndReplyTaskRunner(traits).PostTaskAndReply(
+ from_here, std::move(task), std::move(reply));
}
scoped_refptr<TaskRunner> CreateTaskRunnerWithTraits(
« no previous file with comments | « base/task_scheduler/post_task.h ('k') | base/task_scheduler/scheduler_worker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698