OLD | NEW |
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 Loading... |
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 |
OLD | NEW |