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 base::Closure task, | 71 base::OnceClosure task, |
72 base::TimeDelta delay) { | 72 base::TimeDelta delay) { |
73 EnsureMessageLoop(); | 73 EnsureMessageLoop(); |
74 return original_task_runner_->PostDelayedTask(from_here, std::move(task), | 74 return original_task_runner_->PostDelayedTask(from_here, std::move(task), |
75 delay); | 75 delay); |
76 } | 76 } |
77 | 77 |
78 bool LazySchedulerMessageLoopDelegateForTests::PostNonNestableDelayedTask( | 78 bool LazySchedulerMessageLoopDelegateForTests::PostNonNestableDelayedTask( |
79 const tracked_objects::Location& from_here, | 79 const tracked_objects::Location& from_here, |
80 base::Closure task, | 80 base::OnceClosure task, |
81 base::TimeDelta delay) { | 81 base::TimeDelta delay) { |
82 EnsureMessageLoop(); | 82 EnsureMessageLoop(); |
83 return original_task_runner_->PostNonNestableDelayedTask( | 83 return original_task_runner_->PostNonNestableDelayedTask( |
84 from_here, std::move(task), delay); | 84 from_here, std::move(task), delay); |
85 } | 85 } |
86 | 86 |
87 bool LazySchedulerMessageLoopDelegateForTests::RunsTasksOnCurrentThread() | 87 bool LazySchedulerMessageLoopDelegateForTests::RunsTasksOnCurrentThread() |
88 const { | 88 const { |
89 return thread_id_ == base::PlatformThread::CurrentId(); | 89 return thread_id_ == base::PlatformThread::CurrentId(); |
90 } | 90 } |
(...skipping 20 matching lines...) Expand all Loading... |
111 } | 111 } |
112 message_loop_->RemoveNestingObserver(observer); | 112 message_loop_->RemoveNestingObserver(observer); |
113 } | 113 } |
114 | 114 |
115 base::TimeTicks LazySchedulerMessageLoopDelegateForTests::NowTicks() { | 115 base::TimeTicks LazySchedulerMessageLoopDelegateForTests::NowTicks() { |
116 return time_source_->NowTicks(); | 116 return time_source_->NowTicks(); |
117 } | 117 } |
118 | 118 |
119 } // namespace scheduler | 119 } // namespace scheduler |
120 } // namespace blink | 120 } // namespace blink |
OLD | NEW |