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

Unified Diff: base/test/test_simple_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/test/test_simple_task_runner.h ('k') | base/threading/post_task_and_reply_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/test/test_simple_task_runner.cc
diff --git a/base/test/test_simple_task_runner.cc b/base/test/test_simple_task_runner.cc
index 29d0208fecd2ebeb1a2784597f5f26018d9580a7..08dd162438b955c79cb25ae1f79ea9178396fd9f 100644
--- a/base/test/test_simple_task_runner.cc
+++ b/base/test/test_simple_task_runner.cc
@@ -14,23 +14,23 @@ TestSimpleTaskRunner::~TestSimpleTaskRunner() = default;
bool TestSimpleTaskRunner::PostDelayedTask(
const tracked_objects::Location& from_here,
- const Closure& task,
+ OnceClosure task,
TimeDelta delay) {
AutoLock auto_lock(lock_);
- pending_tasks_.push_back(
- TestPendingTask(from_here, task, TimeTicks(), delay,
- TestPendingTask::NESTABLE));
+ pending_tasks_.push_back(TestPendingTask(from_here, std::move(task),
+ TimeTicks(), delay,
+ TestPendingTask::NESTABLE));
return true;
}
bool TestSimpleTaskRunner::PostNonNestableDelayedTask(
const tracked_objects::Location& from_here,
- const Closure& task,
+ OnceClosure task,
TimeDelta delay) {
AutoLock auto_lock(lock_);
- pending_tasks_.push_back(
- TestPendingTask(from_here, task, TimeTicks(), delay,
- TestPendingTask::NON_NESTABLE));
+ pending_tasks_.push_back(TestPendingTask(from_here, std::move(task),
+ TimeTicks(), delay,
+ TestPendingTask::NON_NESTABLE));
return true;
}
@@ -84,8 +84,8 @@ void TestSimpleTaskRunner::RunPendingTasks() {
tasks_to_run.swap(pending_tasks_);
}
- for (const auto& task : tasks_to_run)
- task.task.Run();
+ for (auto& task : tasks_to_run)
+ std::move(task.task).Run();
}
void TestSimpleTaskRunner::RunUntilIdle() {
« no previous file with comments | « base/test/test_simple_task_runner.h ('k') | base/threading/post_task_and_reply_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698