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

Side by Side Diff: base/test/scoped_mock_time_message_loop_task_runner.cc

Issue 2791243002: Rewrite base::Bind into base::BindOnce on trivial cases in base (Closed)
Patch Set: rebase Created 3 years, 8 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 unified diff | Download patch
« no previous file with comments | « base/test/launcher/unit_test_launcher.cc ('k') | base/test/scoped_task_scheduler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/test/scoped_mock_time_message_loop_task_runner.h" 5 #include "base/test/scoped_mock_time_message_loop_task_runner.h"
6 6
7 #include <deque> 7 #include <deque>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 23 matching lines...) Expand all
34 } 34 }
35 35
36 ScopedMockTimeMessageLoopTaskRunner::~ScopedMockTimeMessageLoopTaskRunner() { 36 ScopedMockTimeMessageLoopTaskRunner::~ScopedMockTimeMessageLoopTaskRunner() {
37 DCHECK(previous_task_runner_->RunsTasksOnCurrentThread()); 37 DCHECK(previous_task_runner_->RunsTasksOnCurrentThread());
38 DCHECK_EQ(task_runner_, ThreadTaskRunnerHandle::Get()); 38 DCHECK_EQ(task_runner_, ThreadTaskRunnerHandle::Get());
39 for (auto& pending_task : task_runner_->TakePendingTasks()) { 39 for (auto& pending_task : task_runner_->TakePendingTasks()) {
40 // TODO(tzik): Remove RunOnceClosure once TaskRunner migrates from Closure 40 // TODO(tzik): Remove RunOnceClosure once TaskRunner migrates from Closure
41 // to OnceClosure. 41 // to OnceClosure.
42 previous_task_runner_->PostDelayedTask( 42 previous_task_runner_->PostDelayedTask(
43 pending_task.location, 43 pending_task.location,
44 Bind(&RunOnceClosure, Passed(&pending_task.task)), 44 BindOnce(&RunOnceClosure, Passed(&pending_task.task)),
45 pending_task.GetTimeToRun() - task_runner_->NowTicks()); 45 pending_task.GetTimeToRun() - task_runner_->NowTicks());
46 } 46 }
47 MessageLoop::current()->SetTaskRunner(std::move(previous_task_runner_)); 47 MessageLoop::current()->SetTaskRunner(std::move(previous_task_runner_));
48 } 48 }
49 49
50 } // namespace base 50 } // namespace base
OLDNEW
« no previous file with comments | « base/test/launcher/unit_test_launcher.cc ('k') | base/test/scoped_task_scheduler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698