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