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 "modules/compositorworker/CompositorWorker.h" | 5 #include "modules/compositorworker/CompositorWorker.h" |
6 | 6 |
7 #include "bindings/core/v8/ExceptionState.h" | 7 #include "bindings/core/v8/ExceptionState.h" |
8 #include "core/dom/Document.h" | 8 #include "core/dom/Document.h" |
9 #include "core/dom/ExceptionCode.h" | 9 #include "core/dom/ExceptionCode.h" |
10 #include "core/workers/WorkerClients.h" | 10 #include "core/workers/WorkerClients.h" |
11 #include "modules/EventTargetModules.h" | 11 #include "modules/EventTargetModules.h" |
12 #include "modules/compositorworker/CompositorWorkerMessagingProxy.h" | 12 #include "modules/compositorworker/CompositorWorkerMessagingProxy.h" |
13 #include "modules/compositorworker/CompositorWorkerThread.h" | |
13 | 14 |
14 namespace blink { | 15 namespace blink { |
15 | 16 |
16 inline CompositorWorker::CompositorWorker(ExecutionContext* context) | 17 inline CompositorWorker::CompositorWorker(ExecutionContext* context) |
17 : InProcessWorkerBase(context) | 18 : InProcessWorkerBase(context) |
18 { | 19 { |
19 } | 20 } |
20 | 21 |
21 CompositorWorker* CompositorWorker::create(ExecutionContext* context, const Stri ng& url, ExceptionState& exceptionState) | 22 CompositorWorker* CompositorWorker::create(ExecutionContext* context, const Stri ng& url, ExceptionState& exceptionState) |
22 { | 23 { |
24 // Ensure the compositor worker backing thread is ready. | |
25 CompositorWorkerThread::ensureSharedBackingThread(); | |
haraken
2016/05/09 02:00:53
Move this just before worker->initialize? At least
flackr
2016/05/10 18:07:39
Unless I'm mistaken, we have to ensure the shared
| |
26 | |
23 ASSERT(isMainThread()); | 27 ASSERT(isMainThread()); |
24 Document* document = toDocument(context); | 28 Document* document = toDocument(context); |
25 if (!document->page()) { | 29 if (!document->page()) { |
26 exceptionState.throwDOMException(InvalidAccessError, "The context provid ed is invalid."); | 30 exceptionState.throwDOMException(InvalidAccessError, "The context provid ed is invalid."); |
27 return nullptr; | 31 return nullptr; |
28 } | 32 } |
29 CompositorWorker* worker = new CompositorWorker(context); | 33 CompositorWorker* worker = new CompositorWorker(context); |
30 if (worker->initialize(context, url, exceptionState)) | 34 if (worker->initialize(context, url, exceptionState)) |
31 return worker; | 35 return worker; |
32 return nullptr; | 36 return nullptr; |
33 } | 37 } |
34 | 38 |
35 CompositorWorker::~CompositorWorker() | 39 CompositorWorker::~CompositorWorker() |
36 { | 40 { |
37 ASSERT(isMainThread()); | 41 ASSERT(isMainThread()); |
38 } | 42 } |
39 | 43 |
40 const AtomicString& CompositorWorker::interfaceName() const | 44 const AtomicString& CompositorWorker::interfaceName() const |
41 { | 45 { |
42 return EventTargetNames::CompositorWorker; | 46 return EventTargetNames::CompositorWorker; |
43 } | 47 } |
44 | 48 |
45 InProcessWorkerGlobalScopeProxy* CompositorWorker::createInProcessWorkerGlobalSc opeProxy(ExecutionContext* worker) | 49 InProcessWorkerGlobalScopeProxy* CompositorWorker::createInProcessWorkerGlobalSc opeProxy(ExecutionContext* worker) |
46 { | 50 { |
47 ASSERT(getExecutionContext()->isDocument()); | 51 ASSERT(getExecutionContext()->isDocument()); |
48 return new CompositorWorkerMessagingProxy(this); | 52 return new CompositorWorkerMessagingProxy(this); |
49 } | 53 } |
50 | 54 |
51 } // namespace blink | 55 } // namespace blink |
OLD | NEW |