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

Unified Diff: cc/test/ordered_simple_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 | « cc/test/ordered_simple_task_runner.h ('k') | cc/tiles/image_controller.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/test/ordered_simple_task_runner.cc
diff --git a/cc/test/ordered_simple_task_runner.cc b/cc/test/ordered_simple_task_runner.cc
index 98b943b7df3325459dd4abb1b46721720b3bce09..fd263f07a9f7c48c803d025db2dab87f8cf06684 100644
--- a/cc/test/ordered_simple_task_runner.cc
+++ b/cc/test/ordered_simple_task_runner.cc
@@ -11,6 +11,7 @@
#include <set>
#include <sstream>
#include <string>
+#include <utility>
#include <vector>
#include "base/auto_reset.h"
@@ -35,13 +36,16 @@ TestOrderablePendingTask::TestOrderablePendingTask()
TestOrderablePendingTask::TestOrderablePendingTask(
const tracked_objects::Location& location,
- const base::Closure& task,
+ base::Closure task,
base::TimeTicks post_time,
base::TimeDelta delay,
TestNestability nestability)
- : base::TestPendingTask(location, task, post_time, delay, nestability),
- task_id_(TestOrderablePendingTask::task_id_counter++) {
-}
+ : base::TestPendingTask(location,
+ std::move(task),
+ post_time,
+ delay,
+ nestability),
+ task_id_(TestOrderablePendingTask::task_id_counter++) {}
TestOrderablePendingTask::TestOrderablePendingTask(TestOrderablePendingTask&&) =
default;
@@ -105,11 +109,11 @@ base::TimeTicks OrderedSimpleTaskRunner::AbsoluteMaxNow() {
// base::TestSimpleTaskRunner implementation
bool OrderedSimpleTaskRunner::PostDelayedTask(
const tracked_objects::Location& from_here,
- const base::Closure& task,
+ base::Closure task,
base::TimeDelta delay) {
DCHECK(thread_checker_.CalledOnValidThread());
- TestOrderablePendingTask pt(from_here, task, now_src_->NowTicks(), delay,
- base::TestPendingTask::NESTABLE);
+ TestOrderablePendingTask pt(from_here, std::move(task), now_src_->NowTicks(),
+ delay, base::TestPendingTask::NESTABLE);
TRACE_TASK("OrderedSimpleTaskRunner::PostDelayedTask", pt);
pending_tasks_.insert(std::move(pt));
@@ -118,11 +122,11 @@ bool OrderedSimpleTaskRunner::PostDelayedTask(
bool OrderedSimpleTaskRunner::PostNonNestableDelayedTask(
const tracked_objects::Location& from_here,
- const base::Closure& task,
+ base::Closure task,
base::TimeDelta delay) {
DCHECK(thread_checker_.CalledOnValidThread());
- TestOrderablePendingTask pt(from_here, task, now_src_->NowTicks(), delay,
- base::TestPendingTask::NON_NESTABLE);
+ TestOrderablePendingTask pt(from_here, std::move(task), now_src_->NowTicks(),
+ delay, base::TestPendingTask::NON_NESTABLE);
TRACE_TASK("OrderedSimpleTaskRunner::PostNonNestableDelayedTask", pt);
pending_tasks_.insert(std::move(pt));
« no previous file with comments | « cc/test/ordered_simple_task_runner.h ('k') | cc/tiles/image_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698