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/child/scheduler_tqm_delegate_impl.h" | 5 #include "platform/scheduler/child/scheduler_tqm_delegate_impl.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
| 9 #include "base/run_loop.h" |
| 10 |
9 namespace blink { | 11 namespace blink { |
10 namespace scheduler { | 12 namespace scheduler { |
11 | 13 |
12 // static | 14 // static |
13 scoped_refptr<SchedulerTqmDelegateImpl> SchedulerTqmDelegateImpl::Create( | 15 scoped_refptr<SchedulerTqmDelegateImpl> SchedulerTqmDelegateImpl::Create( |
14 base::MessageLoop* message_loop, | 16 base::MessageLoop* message_loop, |
15 std::unique_ptr<base::TickClock> time_source) { | 17 std::unique_ptr<base::TickClock> time_source) { |
16 return make_scoped_refptr( | 18 return make_scoped_refptr( |
17 new SchedulerTqmDelegateImpl(message_loop, std::move(time_source))); | 19 new SchedulerTqmDelegateImpl(message_loop, std::move(time_source))); |
18 } | 20 } |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 base::TimeDelta delay) { | 54 base::TimeDelta delay) { |
53 return message_loop_task_runner_->PostNonNestableDelayedTask( | 55 return message_loop_task_runner_->PostNonNestableDelayedTask( |
54 from_here, std::move(task), delay); | 56 from_here, std::move(task), delay); |
55 } | 57 } |
56 | 58 |
57 bool SchedulerTqmDelegateImpl::RunsTasksOnCurrentThread() const { | 59 bool SchedulerTqmDelegateImpl::RunsTasksOnCurrentThread() const { |
58 return message_loop_task_runner_->RunsTasksOnCurrentThread(); | 60 return message_loop_task_runner_->RunsTasksOnCurrentThread(); |
59 } | 61 } |
60 | 62 |
61 bool SchedulerTqmDelegateImpl::IsNested() const { | 63 bool SchedulerTqmDelegateImpl::IsNested() const { |
62 return message_loop_->IsNested(); | 64 DCHECK(RunsTasksOnCurrentThread()); |
| 65 return base::RunLoop::IsNestedOnCurrentThread(); |
63 } | 66 } |
64 | 67 |
65 void SchedulerTqmDelegateImpl::AddNestingObserver( | 68 void SchedulerTqmDelegateImpl::AddNestingObserver( |
66 base::MessageLoop::NestingObserver* observer) { | 69 base::RunLoop::NestingObserver* observer) { |
67 message_loop_->AddNestingObserver(observer); | 70 base::RunLoop::AddNestingObserverOnCurrentThread(observer); |
68 } | 71 } |
69 | 72 |
70 void SchedulerTqmDelegateImpl::RemoveNestingObserver( | 73 void SchedulerTqmDelegateImpl::RemoveNestingObserver( |
71 base::MessageLoop::NestingObserver* observer) { | 74 base::RunLoop::NestingObserver* observer) { |
72 message_loop_->RemoveNestingObserver(observer); | 75 base::RunLoop::RemoveNestingObserverOnCurrentThread(observer); |
73 } | 76 } |
74 | 77 |
75 base::TimeTicks SchedulerTqmDelegateImpl::NowTicks() { | 78 base::TimeTicks SchedulerTqmDelegateImpl::NowTicks() { |
76 return time_source_->NowTicks(); | 79 return time_source_->NowTicks(); |
77 } | 80 } |
78 | 81 |
79 } // namespace scheduler | 82 } // namespace scheduler |
80 } // namespace blink | 83 } // namespace blink |
OLD | NEW |