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

Unified Diff: media/base/fake_single_thread_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 | « media/base/fake_single_thread_task_runner.h ('k') | media/cast/test/skewed_single_thread_task_runner.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/fake_single_thread_task_runner.cc
diff --git a/media/base/fake_single_thread_task_runner.cc b/media/base/fake_single_thread_task_runner.cc
index 77f1f73d3a4ef60c0931f4f548a2e2df8264ef22..4fe606824e9ec6f2d201435315b921f2180cf8b0 100644
--- a/media/base/fake_single_thread_task_runner.cc
+++ b/media/base/fake_single_thread_task_runner.cc
@@ -18,7 +18,7 @@ FakeSingleThreadTaskRunner::~FakeSingleThreadTaskRunner() {}
bool FakeSingleThreadTaskRunner::PostDelayedTask(
const tracked_objects::Location& from_here,
- const base::Closure& task,
+ base::OnceClosure task,
base::TimeDelta delay) {
if (fail_on_next_task_) {
LOG(FATAL) << "Infinite task posting loop detected. Possibly caused by "
@@ -40,16 +40,16 @@ bool FakeSingleThreadTaskRunner::PostDelayedTask(
auto it = after_it;
--it;
if (it->first.first == run_time) {
- tasks_.insert(
- after_it /* hint */,
- std::make_pair(TaskKey(run_time, it->first.second + 1), task));
+ tasks_.insert(after_it /* hint */,
+ std::make_pair(TaskKey(run_time, it->first.second + 1),
+ std::move(task)));
return true;
}
}
}
// No tasks have the exact same run time, so just do a simple insert.
- tasks_.insert(std::make_pair(TaskKey(run_time, 0), task));
+ tasks_.insert(std::make_pair(TaskKey(run_time, 0), std::move(task)));
return true;
}
@@ -67,9 +67,9 @@ void FakeSingleThreadTaskRunner::RunTasks() {
if (clock_->NowTicks() < it->first.first)
return;
- const base::Closure task = it->second;
+ base::OnceClosure task = std::move(it->second);
tasks_.erase(it);
- task.Run();
+ std::move(task).Run();
}
}
@@ -88,9 +88,9 @@ void FakeSingleThreadTaskRunner::Sleep(base::TimeDelta t) {
}
clock_->Advance(it->first.first - clock_->NowTicks());
- const base::Closure task = it->second;
+ base::OnceClosure task = std::move(it->second);
tasks_.erase(it);
- task.Run();
+ std::move(task).Run();
}
// If this point is reached, there's likely some sort of case where a new
@@ -104,7 +104,7 @@ void FakeSingleThreadTaskRunner::Sleep(base::TimeDelta t) {
bool FakeSingleThreadTaskRunner::PostNonNestableDelayedTask(
const tracked_objects::Location& from_here,
- const base::Closure& task,
+ base::OnceClosure task,
base::TimeDelta delay) {
NOTIMPLEMENTED();
return false;
« no previous file with comments | « media/base/fake_single_thread_task_runner.h ('k') | media/cast/test/skewed_single_thread_task_runner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698