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/CompositorWorker.h" | 6 #include "modules/compositorworker/CompositorWorker.h" |
7 | 7 |
8 #include "bindings/core/v8/ExceptionState.h" | 8 #include "bindings/core/v8/ExceptionState.h" |
9 #include "core/dom/Document.h" | 9 #include "core/dom/Document.h" |
10 #include "core/dom/ExceptionCode.h" | 10 #include "core/dom/ExceptionCode.h" |
11 #include "core/workers/WorkerClients.h" | 11 #include "core/workers/WorkerClients.h" |
12 #include "modules/EventTargetModules.h" | 12 #include "modules/EventTargetModules.h" |
13 #include "modules/compositorworker/CompositorWorkerMessagingProxy.h" | 13 #include "modules/compositorworker/CompositorWorkerMessagingProxy.h" |
14 #include "wtf/MainThread.h" | 14 #include "wtf/MainThread.h" |
15 | 15 |
16 namespace blink { | 16 namespace blink { |
17 | 17 |
18 inline CompositorWorker::CompositorWorker(ExecutionContext* context) | 18 inline CompositorWorker::CompositorWorker(ExecutionContext* context) |
19 : InProcessWorkerBase(context) | 19 : InProcessWorkerBase(context) |
20 { | 20 { |
21 } | 21 } |
22 | 22 |
23 PassRefPtrWillBeRawPtr<CompositorWorker> CompositorWorker::create(ExecutionConte
xt* context, const String& url, ExceptionState& exceptionState) | 23 CompositorWorker* CompositorWorker::create(ExecutionContext* context, const Stri
ng& url, ExceptionState& exceptionState) |
24 { | 24 { |
25 ASSERT(isMainThread()); | 25 ASSERT(isMainThread()); |
26 Document* document = toDocument(context); | 26 Document* document = toDocument(context); |
27 if (!document->page()) { | 27 if (!document->page()) { |
28 exceptionState.throwDOMException(InvalidAccessError, "The context provid
ed is invalid."); | 28 exceptionState.throwDOMException(InvalidAccessError, "The context provid
ed is invalid."); |
29 return nullptr; | 29 return nullptr; |
30 } | 30 } |
31 RefPtrWillBeRawPtr<CompositorWorker> worker = adoptRefWillBeNoop(new Composi
torWorker(context)); | 31 CompositorWorker* worker = new CompositorWorker(context); |
32 if (worker->initialize(context, url, exceptionState)) | 32 if (worker->initialize(context, url, exceptionState)) |
33 return worker.release(); | 33 return worker; |
34 return nullptr; | 34 return nullptr; |
35 } | 35 } |
36 | 36 |
37 CompositorWorker::~CompositorWorker() | 37 CompositorWorker::~CompositorWorker() |
38 { | 38 { |
39 ASSERT(isMainThread()); | 39 ASSERT(isMainThread()); |
40 } | 40 } |
41 | 41 |
42 const AtomicString& CompositorWorker::interfaceName() const | 42 const AtomicString& CompositorWorker::interfaceName() const |
43 { | 43 { |
44 return EventTargetNames::CompositorWorker; | 44 return EventTargetNames::CompositorWorker; |
45 } | 45 } |
46 | 46 |
47 WorkerGlobalScopeProxy* CompositorWorker::createWorkerGlobalScopeProxy(Execution
Context* worker) | 47 WorkerGlobalScopeProxy* CompositorWorker::createWorkerGlobalScopeProxy(Execution
Context* worker) |
48 { | 48 { |
49 ASSERT(executionContext()->isDocument()); | 49 ASSERT(executionContext()->isDocument()); |
50 return new CompositorWorkerMessagingProxy(this); | 50 return new CompositorWorkerMessagingProxy(this); |
51 } | 51 } |
52 | 52 |
53 } // namespace blink | 53 } // namespace blink |
OLD | NEW |