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

Unified Diff: base/message_loop/message_loop_task_runner.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/message_loop/message_loop_task_runner.h ('k') | base/sequenced_task_runner.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/message_loop/message_loop_task_runner.cc
diff --git a/base/message_loop/message_loop_task_runner.cc b/base/message_loop/message_loop_task_runner.cc
index c9b5ffe3f739d0bdb312f3ac3d6d6de8e4adf580..ddfdeb2b65b5dbf337edcf35457877ed38b2993e 100644
--- a/base/message_loop/message_loop_task_runner.cc
+++ b/base/message_loop/message_loop_task_runner.cc
@@ -4,6 +4,8 @@
#include "base/message_loop/message_loop_task_runner.h"
+#include <utility>
+
#include "base/location.h"
#include "base/logging.h"
#include "base/message_loop/incoming_task_queue.h"
@@ -24,18 +26,20 @@ void MessageLoopTaskRunner::BindToCurrentThread() {
bool MessageLoopTaskRunner::PostDelayedTask(
const tracked_objects::Location& from_here,
- const base::Closure& task,
+ Closure task,
base::TimeDelta delay) {
DCHECK(!task.is_null()) << from_here.ToString();
- return incoming_queue_->AddToIncomingQueue(from_here, task, delay, true);
+ return incoming_queue_->AddToIncomingQueue(from_here, std::move(task), delay,
+ true);
}
bool MessageLoopTaskRunner::PostNonNestableDelayedTask(
const tracked_objects::Location& from_here,
- const base::Closure& task,
+ Closure task,
base::TimeDelta delay) {
DCHECK(!task.is_null()) << from_here.ToString();
- return incoming_queue_->AddToIncomingQueue(from_here, task, delay, false);
+ return incoming_queue_->AddToIncomingQueue(from_here, std::move(task), delay,
+ false);
}
bool MessageLoopTaskRunner::RunsTasksOnCurrentThread() const {
« no previous file with comments | « base/message_loop/message_loop_task_runner.h ('k') | base/sequenced_task_runner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698