| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "base/test/test_pending_task.h" | 7 #include "base/test/test_pending_task.h" |
| 8 | 8 |
| 9 namespace base { | 9 namespace base { |
| 10 | 10 |
| 11 TestPendingTask::TestPendingTask() : nestability(NESTABLE) {} | 11 TestPendingTask::TestPendingTask() : nestability(NESTABLE) {} |
| 12 | 12 |
| 13 TestPendingTask::TestPendingTask( | 13 TestPendingTask::TestPendingTask(const tracked_objects::Location& location, |
| 14 const tracked_objects::Location& location, | 14 OnceClosure task, |
| 15 const Closure& task, | 15 TimeTicks post_time, |
| 16 TimeTicks post_time, | 16 TimeDelta delay, |
| 17 TimeDelta delay, | 17 TestNestability nestability) |
| 18 TestNestability nestability) | |
| 19 : location(location), | 18 : location(location), |
| 20 task(task), | 19 task(std::move(task)), |
| 21 post_time(post_time), | 20 post_time(post_time), |
| 22 delay(delay), | 21 delay(delay), |
| 23 nestability(nestability) {} | 22 nestability(nestability) {} |
| 24 | 23 |
| 25 TestPendingTask::TestPendingTask(const TestPendingTask& other) = default; | 24 TestPendingTask::TestPendingTask(TestPendingTask&& other) = default; |
| 25 |
| 26 TestPendingTask& TestPendingTask::operator=(TestPendingTask&& other) = default; |
| 26 | 27 |
| 27 TimeTicks TestPendingTask::GetTimeToRun() const { | 28 TimeTicks TestPendingTask::GetTimeToRun() const { |
| 28 return post_time + delay; | 29 return post_time + delay; |
| 29 } | 30 } |
| 30 | 31 |
| 31 bool TestPendingTask::ShouldRunBefore(const TestPendingTask& other) const { | 32 bool TestPendingTask::ShouldRunBefore(const TestPendingTask& other) const { |
| 32 if (nestability != other.nestability) | 33 if (nestability != other.nestability) |
| 33 return (nestability == NESTABLE); | 34 return (nestability == NESTABLE); |
| 34 return GetTimeToRun() < other.GetTimeToRun(); | 35 return GetTimeToRun() < other.GetTimeToRun(); |
| 35 } | 36 } |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 std::ostream& operator<<(std::ostream& os, const TestPendingTask& task) { | 71 std::ostream& operator<<(std::ostream& os, const TestPendingTask& task) { |
| 71 PrintTo(task, &os); | 72 PrintTo(task, &os); |
| 72 return os; | 73 return os; |
| 73 } | 74 } |
| 74 | 75 |
| 75 void PrintTo(const TestPendingTask& task, std::ostream* os) { | 76 void PrintTo(const TestPendingTask& task, std::ostream* os) { |
| 76 *os << task.ToString(); | 77 *os << task.ToString(); |
| 77 } | 78 } |
| 78 | 79 |
| 79 } // namespace base | 80 } // namespace base |
| OLD | NEW |