| 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" |
| 16 #include "platform/scheduler/child/webthread_impl_for_worker_scheduler.h" | 17 #include "platform/scheduler/child/webthread_impl_for_worker_scheduler.h" |
| 17 #include "platform/scheduler/utility/webthread_impl_for_utility_thread.h" | 18 #include "platform/scheduler/utility/webthread_impl_for_utility_thread.h" |
| 18 #include "public/platform/WebTraceLocation.h" | 19 #include "public/platform/WebTraceLocation.h" |
| 19 #include "public/platform/scheduler/child/single_thread_idle_task_runner.h" | 20 #include "public/platform/scheduler/child/single_thread_idle_task_runner.h" |
| 20 | 21 |
| 21 namespace blink { | 22 namespace blink { |
| 22 namespace scheduler { | 23 namespace scheduler { |
| 23 | 24 |
| 24 class WebThreadBase::TaskObserverAdapter | 25 class WebThreadBase::TaskObserverAdapter |
| 25 : public base::MessageLoop::TaskObserver { | 26 : public base::MessageLoop::TaskObserver { |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 explicit WebThreadForCompositor(base::Thread::Options options) | 111 explicit WebThreadForCompositor(base::Thread::Options options) |
| 111 : WebThreadImplForWorkerScheduler("Compositor", options) { | 112 : WebThreadImplForWorkerScheduler("Compositor", options) { |
| 112 Init(); | 113 Init(); |
| 113 } | 114 } |
| 114 ~WebThreadForCompositor() override {} | 115 ~WebThreadForCompositor() override {} |
| 115 | 116 |
| 116 private: | 117 private: |
| 117 // WebThreadImplForWorkerScheduler: | 118 // WebThreadImplForWorkerScheduler: |
| 118 std::unique_ptr<blink::scheduler::WorkerScheduler> CreateWorkerScheduler() | 119 std::unique_ptr<blink::scheduler::WorkerScheduler> CreateWorkerScheduler() |
| 119 override { | 120 override { |
| 120 return base::MakeUnique<CompositorWorkerScheduler>(GetThread()); | 121 return base::MakeUnique<CompositorWorkerScheduler>(GetThread(), |
| 122 task_runner_delegate()); |
| 121 } | 123 } |
| 122 | 124 |
| 123 DISALLOW_COPY_AND_ASSIGN(WebThreadForCompositor); | 125 DISALLOW_COPY_AND_ASSIGN(WebThreadForCompositor); |
| 124 }; | 126 }; |
| 125 | 127 |
| 126 } // namespace | 128 } // namespace |
| 127 | 129 |
| 128 std::unique_ptr<WebThreadBase> WebThreadBase::CreateWorkerThread( | 130 std::unique_ptr<WebThreadBase> WebThreadBase::CreateWorkerThread( |
| 129 const char* name, | 131 const char* name, |
| 130 base::Thread::Options options) { | 132 base::Thread::Options options) { |
| 131 return base::MakeUnique<WebThreadImplForWorkerScheduler>(name, options); | 133 return base::MakeUnique<WebThreadImplForWorkerScheduler>(name, options); |
| 132 } | 134 } |
| 133 | 135 |
| 134 std::unique_ptr<WebThreadBase> WebThreadBase::CreateCompositorThread( | 136 std::unique_ptr<WebThreadBase> WebThreadBase::CreateCompositorThread( |
| 135 base::Thread::Options options) { | 137 base::Thread::Options options) { |
| 136 return base::MakeUnique<WebThreadForCompositor>(options); | 138 return base::MakeUnique<WebThreadForCompositor>(options); |
| 137 } | 139 } |
| 138 | 140 |
| 139 std::unique_ptr<WebThreadBase> WebThreadBase::InitializeUtilityThread() { | 141 std::unique_ptr<WebThreadBase> WebThreadBase::InitializeUtilityThread() { |
| 140 return base::MakeUnique<WebThreadImplForUtilityThread>(); | 142 return base::MakeUnique<WebThreadImplForUtilityThread>(); |
| 141 } | 143 } |
| 142 | 144 |
| 143 } // namespace scheduler | 145 } // namespace scheduler |
| 144 } // namespace blink | 146 } // namespace blink |
| OLD | NEW |