OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "config.h" |
| 6 #include "modules/compositorworker/CompositorWorkerGlobalScope.h" |
| 7 |
| 8 #include "bindings/core/v8/SerializedScriptValue.h" |
| 9 #include "core/workers/WorkerObjectProxy.h" |
| 10 #include "core/workers/WorkerThreadStartupData.h" |
| 11 #include "modules/EventTargetModules.h" |
| 12 #include "modules/compositorworker/CompositorWorkerThread.h" |
| 13 |
| 14 namespace blink { |
| 15 |
| 16 PassRefPtrWillBeRawPtr<CompositorWorkerGlobalScope> CompositorWorkerGlobalScope:
:create(CompositorWorkerThread* thread, PassOwnPtrWillBeRawPtr<WorkerThreadStart
upData> startupData, double timeOrigin) |
| 17 { |
| 18 RefPtrWillBeRawPtr<CompositorWorkerGlobalScope> context = adoptRefWillBeNoop
(new CompositorWorkerGlobalScope(startupData->m_scriptURL, startupData->m_userAg
ent, thread, timeOrigin, startupData->m_starterOrigin, startupData->m_workerClie
nts.release())); |
| 19 context->applyContentSecurityPolicyFromString(startupData->m_contentSecurity
Policy, startupData->m_contentSecurityPolicyType); |
| 20 return context.release(); |
| 21 } |
| 22 |
| 23 CompositorWorkerGlobalScope::CompositorWorkerGlobalScope(const KURL& url, const
String& userAgent, CompositorWorkerThread* thread, double timeOrigin, const Secu
rityOrigin* starterOrigin, PassOwnPtrWillBeRawPtr<WorkerClients> workerClients) |
| 24 : WorkerGlobalScope(url, userAgent, thread, timeOrigin, starterOrigin, worke
rClients) |
| 25 { |
| 26 } |
| 27 |
| 28 CompositorWorkerGlobalScope::~CompositorWorkerGlobalScope() |
| 29 { |
| 30 } |
| 31 |
| 32 const AtomicString& CompositorWorkerGlobalScope::interfaceName() const |
| 33 { |
| 34 return EventTargetNames::CompositorWorkerGlobalScope; |
| 35 } |
| 36 |
| 37 void CompositorWorkerGlobalScope::postMessage(ExecutionContext*, PassRefPtr<Seri
alizedScriptValue> message, const MessagePortArray* ports, ExceptionState& excep
tionState) |
| 38 { |
| 39 // Disentangle the port in preparation for sending it to the remote context. |
| 40 OwnPtr<MessagePortChannelArray> channels = MessagePort::disentanglePorts(por
ts, exceptionState); |
| 41 if (exceptionState.hadException()) |
| 42 return; |
| 43 thread()->workerObjectProxy().postMessageToWorkerObject(message, channels.re
lease()); |
| 44 } |
| 45 |
| 46 CompositorWorkerThread* CompositorWorkerGlobalScope::thread() const |
| 47 { |
| 48 return static_cast<CompositorWorkerThread*>(WorkerGlobalScope::thread()); |
| 49 } |
| 50 |
| 51 } // namespace blink |
OLD | NEW |