OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 // An implementation of WebThread in terms of base::MessageLoop and | 5 // An implementation of WebThread in terms of base::MessageLoop and |
6 // base::Thread | 6 // base::Thread |
7 | 7 |
8 #include "public/platform/scheduler/child/webthread_base.h" | 8 #include "public/platform/scheduler/child/webthread_base.h" |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/bind_helpers.h" | 11 #include "base/bind_helpers.h" |
12 #include "base/memory/ptr_util.h" | 12 #include "base/memory/ptr_util.h" |
13 #include "base/pending_task.h" | 13 #include "base/pending_task.h" |
14 #include "base/threading/platform_thread.h" | 14 #include "base/threading/platform_thread.h" |
15 #include "platform/scheduler/child/compositor_worker_scheduler.h" | 15 #include "platform/scheduler/child/compositor_worker_scheduler.h" |
16 #include "platform/scheduler/child/scheduler_tqm_delegate_impl.h" | |
17 #include "platform/scheduler/child/webthread_impl_for_worker_scheduler.h" | 16 #include "platform/scheduler/child/webthread_impl_for_worker_scheduler.h" |
18 #include "platform/scheduler/utility/webthread_impl_for_utility_thread.h" | 17 #include "platform/scheduler/utility/webthread_impl_for_utility_thread.h" |
19 #include "public/platform/WebTraceLocation.h" | 18 #include "public/platform/WebTraceLocation.h" |
20 #include "public/platform/scheduler/child/single_thread_idle_task_runner.h" | 19 #include "public/platform/scheduler/child/single_thread_idle_task_runner.h" |
21 | 20 |
22 namespace blink { | 21 namespace blink { |
23 namespace scheduler { | 22 namespace scheduler { |
24 | 23 |
25 class WebThreadBase::TaskObserverAdapter | 24 class WebThreadBase::TaskObserverAdapter |
26 : public base::MessageLoop::TaskObserver { | 25 : public base::MessageLoop::TaskObserver { |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 explicit WebThreadForCompositor(base::Thread::Options options) | 110 explicit WebThreadForCompositor(base::Thread::Options options) |
112 : WebThreadImplForWorkerScheduler("Compositor", options) { | 111 : WebThreadImplForWorkerScheduler("Compositor", options) { |
113 Init(); | 112 Init(); |
114 } | 113 } |
115 ~WebThreadForCompositor() override {} | 114 ~WebThreadForCompositor() override {} |
116 | 115 |
117 private: | 116 private: |
118 // WebThreadImplForWorkerScheduler: | 117 // WebThreadImplForWorkerScheduler: |
119 std::unique_ptr<blink::scheduler::WorkerScheduler> CreateWorkerScheduler() | 118 std::unique_ptr<blink::scheduler::WorkerScheduler> CreateWorkerScheduler() |
120 override { | 119 override { |
121 return base::MakeUnique<CompositorWorkerScheduler>(GetThread(), | 120 return base::MakeUnique<CompositorWorkerScheduler>(GetThread()); |
122 task_runner_delegate()); | |
123 } | 121 } |
124 | 122 |
125 DISALLOW_COPY_AND_ASSIGN(WebThreadForCompositor); | 123 DISALLOW_COPY_AND_ASSIGN(WebThreadForCompositor); |
126 }; | 124 }; |
127 | 125 |
128 } // namespace | 126 } // namespace |
129 | 127 |
130 std::unique_ptr<WebThreadBase> WebThreadBase::CreateWorkerThread( | 128 std::unique_ptr<WebThreadBase> WebThreadBase::CreateWorkerThread( |
131 const char* name, | 129 const char* name, |
132 base::Thread::Options options) { | 130 base::Thread::Options options) { |
133 return base::MakeUnique<WebThreadImplForWorkerScheduler>(name, options); | 131 return base::MakeUnique<WebThreadImplForWorkerScheduler>(name, options); |
134 } | 132 } |
135 | 133 |
136 std::unique_ptr<WebThreadBase> WebThreadBase::CreateCompositorThread( | 134 std::unique_ptr<WebThreadBase> WebThreadBase::CreateCompositorThread( |
137 base::Thread::Options options) { | 135 base::Thread::Options options) { |
138 return base::MakeUnique<WebThreadForCompositor>(options); | 136 return base::MakeUnique<WebThreadForCompositor>(options); |
139 } | 137 } |
140 | 138 |
141 std::unique_ptr<WebThreadBase> WebThreadBase::InitializeUtilityThread() { | 139 std::unique_ptr<WebThreadBase> WebThreadBase::InitializeUtilityThread() { |
142 return base::MakeUnique<WebThreadImplForUtilityThread>(); | 140 return base::MakeUnique<WebThreadImplForUtilityThread>(); |
143 } | 141 } |
144 | 142 |
145 } // namespace scheduler | 143 } // namespace scheduler |
146 } // namespace blink | 144 } // namespace blink |
OLD | NEW |