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

Unified Diff: base/task_runner.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_runner.h ('k') | base/task_runner_util.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/task_runner.cc
diff --git a/base/task_runner.cc b/base/task_runner.cc
index 262e1f8b09eac8d9f91b4113ddeccc27a33323ad..36aabe952a81d02e509ece4758ad187f9b63b364 100644
--- a/base/task_runner.cc
+++ b/base/task_runner.cc
@@ -4,6 +4,7 @@
#include "base/task_runner.h"
+#include "base/callback.h"
#include "base/compiler_specific.h"
#include "base/logging.h"
#include "base/threading/post_task_and_reply_impl.h"
@@ -21,7 +22,7 @@ class PostTaskAndReplyTaskRunner : public internal::PostTaskAndReplyImpl {
private:
bool PostTask(const tracked_objects::Location& from_here,
- const Closure& task) override;
+ OnceClosure task) override;
// Non-owning.
TaskRunner* destination_;
@@ -34,23 +35,22 @@ PostTaskAndReplyTaskRunner::PostTaskAndReplyTaskRunner(
bool PostTaskAndReplyTaskRunner::PostTask(
const tracked_objects::Location& from_here,
- const Closure& task) {
- return destination_->PostTask(from_here, task);
+ OnceClosure task) {
+ return destination_->PostTask(from_here, std::move(task));
}
} // namespace
bool TaskRunner::PostTask(const tracked_objects::Location& from_here,
- const Closure& task) {
- return PostDelayedTask(from_here, task, base::TimeDelta());
+ OnceClosure task) {
+ return PostDelayedTask(from_here, std::move(task), base::TimeDelta());
}
-bool TaskRunner::PostTaskAndReply(
- const tracked_objects::Location& from_here,
- const Closure& task,
- const Closure& reply) {
+bool TaskRunner::PostTaskAndReply(const tracked_objects::Location& from_here,
+ OnceClosure task,
+ OnceClosure reply) {
return PostTaskAndReplyTaskRunner(this).PostTaskAndReply(
- from_here, task, reply);
+ from_here, std::move(task), std::move(reply));
}
TaskRunner::TaskRunner() {}
« no previous file with comments | « base/task_runner.h ('k') | base/task_runner_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698