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 "platform/scheduler/test/lazy_scheduler_message_loop_delegate_for_tests
.h" | 5 #include "platform/scheduler/test/lazy_scheduler_message_loop_delegate_for_tests
.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "base/time/default_tick_clock.h" | 10 #include "base/time/default_tick_clock.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 if (HasMessageLoop() && base::MessageLoop::current() == message_loop_) | 61 if (HasMessageLoop() && base::MessageLoop::current() == message_loop_) |
62 message_loop_->SetTaskRunner(original_task_runner_); | 62 message_loop_->SetTaskRunner(original_task_runner_); |
63 } | 63 } |
64 | 64 |
65 bool LazySchedulerMessageLoopDelegateForTests::HasMessageLoop() const { | 65 bool LazySchedulerMessageLoopDelegateForTests::HasMessageLoop() const { |
66 return message_loop_ != nullptr; | 66 return message_loop_ != nullptr; |
67 } | 67 } |
68 | 68 |
69 bool LazySchedulerMessageLoopDelegateForTests::PostDelayedTask( | 69 bool LazySchedulerMessageLoopDelegateForTests::PostDelayedTask( |
70 const tracked_objects::Location& from_here, | 70 const tracked_objects::Location& from_here, |
71 const base::Closure& task, | 71 base::Closure task, |
72 base::TimeDelta delay) { | 72 base::TimeDelta delay) { |
73 EnsureMessageLoop(); | 73 EnsureMessageLoop(); |
74 return original_task_runner_->PostDelayedTask(from_here, task, delay); | 74 return original_task_runner_->PostDelayedTask(from_here, std::move(task), |
| 75 delay); |
75 } | 76 } |
76 | 77 |
77 bool LazySchedulerMessageLoopDelegateForTests::PostNonNestableDelayedTask( | 78 bool LazySchedulerMessageLoopDelegateForTests::PostNonNestableDelayedTask( |
78 const tracked_objects::Location& from_here, | 79 const tracked_objects::Location& from_here, |
79 const base::Closure& task, | 80 base::Closure task, |
80 base::TimeDelta delay) { | 81 base::TimeDelta delay) { |
81 EnsureMessageLoop(); | 82 EnsureMessageLoop(); |
82 return original_task_runner_->PostNonNestableDelayedTask(from_here, task, | 83 return original_task_runner_->PostNonNestableDelayedTask( |
83 delay); | 84 from_here, std::move(task), delay); |
84 } | 85 } |
85 | 86 |
86 bool LazySchedulerMessageLoopDelegateForTests::RunsTasksOnCurrentThread() | 87 bool LazySchedulerMessageLoopDelegateForTests::RunsTasksOnCurrentThread() |
87 const { | 88 const { |
88 return thread_id_ == base::PlatformThread::CurrentId(); | 89 return thread_id_ == base::PlatformThread::CurrentId(); |
89 } | 90 } |
90 | 91 |
91 bool LazySchedulerMessageLoopDelegateForTests::IsNested() const { | 92 bool LazySchedulerMessageLoopDelegateForTests::IsNested() const { |
92 return EnsureMessageLoop()->IsNested(); | 93 return EnsureMessageLoop()->IsNested(); |
93 } | 94 } |
(...skipping 16 matching lines...) Expand all Loading... |
110 } | 111 } |
111 message_loop_->RemoveNestingObserver(observer); | 112 message_loop_->RemoveNestingObserver(observer); |
112 } | 113 } |
113 | 114 |
114 base::TimeTicks LazySchedulerMessageLoopDelegateForTests::NowTicks() { | 115 base::TimeTicks LazySchedulerMessageLoopDelegateForTests::NowTicks() { |
115 return time_source_->NowTicks(); | 116 return time_source_->NowTicks(); |
116 } | 117 } |
117 | 118 |
118 } // namespace scheduler | 119 } // namespace scheduler |
119 } // namespace blink | 120 } // namespace blink |
OLD | NEW |