| 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 "config.h" | 5 #include "config.h" |
| 6 #include "modules/compositorworker/CompositorWorkerThread.h" | 6 #include "modules/compositorworker/CompositorWorkerThread.h" |
| 7 | 7 |
| 8 #include "bindings/core/v8/V8Initializer.h" | 8 #include "bindings/core/v8/V8Initializer.h" |
| 9 #include "core/workers/WorkerObjectProxy.h" | 9 #include "core/workers/WorkerObjectProxy.h" |
| 10 #include "core/workers/WorkerThreadStartupData.h" | 10 #include "core/workers/WorkerThreadStartupData.h" |
| 11 #include "core/workers/WorkerV8Isolate.h" |
| 11 #include "modules/compositorworker/CompositorWorkerGlobalScope.h" | 12 #include "modules/compositorworker/CompositorWorkerGlobalScope.h" |
| 13 #include "modules/compositorworker/CompositorWorkerManager.h" |
| 12 #include "public/platform/Platform.h" | 14 #include "public/platform/Platform.h" |
| 13 | 15 |
| 14 namespace blink { | 16 namespace blink { |
| 15 | 17 |
| 16 PassRefPtr<CompositorWorkerThread> CompositorWorkerThread::create(PassRefPtr<Wor
kerLoaderProxy> workerLoaderProxy, WorkerObjectProxy& workerObjectProxy, double
timeOrigin) | 18 PassRefPtr<CompositorWorkerThread> CompositorWorkerThread::create(PassRefPtr<Wor
kerLoaderProxy> workerLoaderProxy, WorkerObjectProxy& workerObjectProxy, double
timeOrigin) |
| 17 { | 19 { |
| 18 ASSERT(isMainThread()); | 20 ASSERT(isMainThread()); |
| 19 return adoptRef(new CompositorWorkerThread(workerLoaderProxy, workerObjectPr
oxy, timeOrigin)); | 21 return adoptRef(new CompositorWorkerThread(workerLoaderProxy, workerObjectPr
oxy, timeOrigin)); |
| 20 } | 22 } |
| 21 | 23 |
| 22 CompositorWorkerThread::CompositorWorkerThread(PassRefPtr<WorkerLoaderProxy> wor
kerLoaderProxy, WorkerObjectProxy& workerObjectProxy, double timeOrigin) | 24 CompositorWorkerThread::CompositorWorkerThread(PassRefPtr<WorkerLoaderProxy> wor
kerLoaderProxy, WorkerObjectProxy& workerObjectProxy, double timeOrigin) |
| 23 : WorkerThread(workerLoaderProxy, workerObjectProxy) | 25 : WorkerThread(workerLoaderProxy, workerObjectProxy) |
| 24 , m_workerObjectProxy(workerObjectProxy) | 26 , m_workerObjectProxy(workerObjectProxy) |
| 25 , m_timeOrigin(timeOrigin) | 27 , m_timeOrigin(timeOrigin) |
| 26 { | 28 { |
| 27 } | 29 } |
| 28 | 30 |
| 29 CompositorWorkerThread::~CompositorWorkerThread() | 31 CompositorWorkerThread::~CompositorWorkerThread() |
| 30 { | 32 { |
| 31 } | 33 } |
| 32 | 34 |
| 33 PassRefPtrWillBeRawPtr<WorkerGlobalScope> CompositorWorkerThread::createWorkerGl
obalScope(PassOwnPtr<WorkerThreadStartupData> startupData) | 35 PassRefPtrWillBeRawPtr<WorkerGlobalScope> CompositorWorkerThread::createWorkerGl
obalScope(PassOwnPtr<WorkerThreadStartupData> startupData) |
| 34 { | 36 { |
| 35 return CompositorWorkerGlobalScope::create(this, startupData, m_timeOrigin); | 37 return CompositorWorkerGlobalScope::create(this, startupData, m_timeOrigin); |
| 36 } | 38 } |
| 37 | 39 |
| 38 WebThreadSupportingGC& CompositorWorkerThread::backingThread() | 40 WebThreadSupportingGC& CompositorWorkerThread::backingThread() |
| 39 { | 41 { |
| 40 if (!m_thread) | 42 if (!m_thread) |
| 41 m_thread = WebThreadSupportingGC::create("CompositorWorker Thread"); | 43 m_thread = &CompositorWorkerManager::instance()->compositorWorkerThread(
); |
| 42 return *m_thread.get(); | 44 return *m_thread; |
| 45 } |
| 46 |
| 47 void CompositorWorkerThread::initializeBackingThread() |
| 48 { |
| 49 CompositorWorkerManager::instance()->initializeBackingThread(); |
| 50 } |
| 51 |
| 52 void CompositorWorkerThread::shutdownBackingThread() |
| 53 { |
| 54 CompositorWorkerManager::instance()->shutdownBackingThread(); |
| 55 } |
| 56 |
| 57 OwnPtr<WorkerV8Isolate>& CompositorWorkerThread::workerIsolate() |
| 58 { |
| 59 if (!m_isolate) { |
| 60 ASSERT(isCurrentThread()); |
| 61 m_isolate = CompositorWorkerManager::instance()->createIsolate(); |
| 62 } |
| 63 return m_isolate; |
| 43 } | 64 } |
| 44 | 65 |
| 45 } // namespace blink | 66 } // namespace blink |
| OLD | NEW |