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

Unified Diff: mojo/public/cpp/bindings/tests/bind_task_runner_unittest.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/cast/test/skewed_single_thread_task_runner.cc ('k') | net/quic/test_tools/test_task_runner.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/cpp/bindings/tests/bind_task_runner_unittest.cc
diff --git a/mojo/public/cpp/bindings/tests/bind_task_runner_unittest.cc b/mojo/public/cpp/bindings/tests/bind_task_runner_unittest.cc
index dab64f012d16f86364bfc529f6493481b877f1be..96ae8189ad0fb8d6333290e71f496ff56c39be44 100644
--- a/mojo/public/cpp/bindings/tests/bind_task_runner_unittest.cc
+++ b/mojo/public/cpp/bindings/tests/bind_task_runner_unittest.cc
@@ -31,18 +31,18 @@ class TestTaskRunner : public base::SingleThreadTaskRunner {
base::WaitableEvent::InitialState::NOT_SIGNALED) {}
bool PostNonNestableDelayedTask(const tracked_objects::Location& from_here,
- const base::Closure& task,
+ base::OnceClosure task,
base::TimeDelta delay) override {
NOTREACHED();
return false;
}
bool PostDelayedTask(const tracked_objects::Location& from_here,
- const base::Closure& task,
+ base::OnceClosure task,
base::TimeDelta delay) override {
{
base::AutoLock locker(lock_);
- tasks_.push(task);
+ tasks_.push(std::move(task));
}
task_ready_.Signal();
return true;
@@ -60,12 +60,12 @@ class TestTaskRunner : public base::SingleThreadTaskRunner {
{
base::AutoLock locker(lock_);
while (!tasks_.empty()) {
- auto task = tasks_.front();
+ auto task = std::move(tasks_.front());
tasks_.pop();
{
base::AutoUnlock unlocker(lock_);
- task.Run();
+ std::move(task).Run();
if (quit_called_)
return;
}
@@ -88,12 +88,12 @@ class TestTaskRunner : public base::SingleThreadTaskRunner {
{
base::AutoLock locker(lock_);
if (!tasks_.empty()) {
- auto task = tasks_.front();
+ auto task = std::move(tasks_.front());
tasks_.pop();
{
base::AutoUnlock unlocker(lock_);
- task.Run();
+ std::move(task).Run();
return;
}
}
@@ -111,7 +111,7 @@ class TestTaskRunner : public base::SingleThreadTaskRunner {
// Protect |tasks_|.
base::Lock lock_;
- std::queue<base::Closure> tasks_;
+ std::queue<base::OnceClosure> tasks_;
DISALLOW_COPY_AND_ASSIGN(TestTaskRunner);
};
« no previous file with comments | « media/cast/test/skewed_single_thread_task_runner.cc ('k') | net/quic/test_tools/test_task_runner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698