| 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 94d8e4834a3b7641296522021cbca850c6a95404..06d87381ee62419b16c4870cb1e0ddaf82421452 100644
|
| --- a/base/test/test_simple_task_runner.cc
|
| +++ b/base/test/test_simple_task_runner.cc
|
| @@ -17,9 +17,9 @@ bool TestSimpleTaskRunner::PostDelayedTask(
|
| const Closure& task,
|
| TimeDelta delay) {
|
| AutoLock auto_lock(lock_);
|
| - pending_tasks_.push_back(
|
| - TestPendingTask(from_here, task, TimeTicks(), delay,
|
| - TestPendingTask::NESTABLE));
|
| + TestPendingTaskInfo task_info(from_here, TimeTicks(), delay,
|
| + TestPendingTaskInfo::NESTABLE);
|
| + pending_tasks_.push_back(std::make_pair(task_info, task));
|
| return true;
|
| }
|
|
|
| @@ -28,9 +28,9 @@ bool TestSimpleTaskRunner::PostNonNestableDelayedTask(
|
| const Closure& task,
|
| TimeDelta delay) {
|
| AutoLock auto_lock(lock_);
|
| - pending_tasks_.push_back(
|
| - TestPendingTask(from_here, task, TimeTicks(), delay,
|
| - TestPendingTask::NON_NESTABLE));
|
| + TestPendingTaskInfo task_info(from_here, TimeTicks(), delay,
|
| + TestPendingTaskInfo::NON_NESTABLE);
|
| + pending_tasks_.push_back(std::make_pair(task_info, task));
|
| return true;
|
| }
|
|
|
| @@ -38,7 +38,7 @@ bool TestSimpleTaskRunner::RunsTasksOnCurrentThread() const {
|
| return thread_ref_ == PlatformThread::CurrentRef();
|
| }
|
|
|
| -std::deque<TestPendingTask> TestSimpleTaskRunner::TakePendingTasks() {
|
| +TestPendingTaskQueue TestSimpleTaskRunner::TakePendingTasks() {
|
| AutoLock auto_lock(lock_);
|
| return std::move(pending_tasks_);
|
| }
|
| @@ -55,12 +55,14 @@ bool TestSimpleTaskRunner::HasPendingTask() const {
|
|
|
| base::TimeDelta TestSimpleTaskRunner::NextPendingTaskDelay() const {
|
| AutoLock auto_lock(lock_);
|
| - return pending_tasks_.front().GetTimeToRun() - base::TimeTicks();
|
| + const TestPendingTaskInfo& task_info = pending_tasks_.front().first;
|
| + return task_info.GetTimeToRun() - base::TimeTicks();
|
| }
|
|
|
| base::TimeDelta TestSimpleTaskRunner::FinalPendingTaskDelay() const {
|
| AutoLock auto_lock(lock_);
|
| - return pending_tasks_.back().GetTimeToRun() - base::TimeTicks();
|
| + const TestPendingTaskInfo& task_info = pending_tasks_.back().first;
|
| + return task_info.GetTimeToRun() - base::TimeTicks();
|
| }
|
|
|
| void TestSimpleTaskRunner::ClearPendingTasks() {
|
| @@ -72,14 +74,14 @@ void TestSimpleTaskRunner::RunPendingTasks() {
|
| DCHECK(RunsTasksOnCurrentThread());
|
|
|
| // Swap with a local variable to avoid re-entrancy problems.
|
| - std::deque<TestPendingTask> tasks_to_run;
|
| + TestPendingTaskQueue tasks_to_run;
|
| {
|
| AutoLock auto_lock(lock_);
|
| 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.second).Run();
|
| }
|
|
|
| void TestSimpleTaskRunner::RunUntilIdle() {
|
|
|