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