Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1851)

Unified Diff: Source/modules/compositorworker/CompositorWorkerGlobalScope.cpp

Issue 1018863002: compositor-worker: Introduce CompositorWorker. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: . Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/modules/compositorworker/CompositorWorkerGlobalScope.cpp
diff --git a/Source/modules/compositorworker/CompositorWorkerGlobalScope.cpp b/Source/modules/compositorworker/CompositorWorkerGlobalScope.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..d4c47c0d724d78d63995f0db74d84815b93c1600
--- /dev/null
+++ b/Source/modules/compositorworker/CompositorWorkerGlobalScope.cpp
@@ -0,0 +1,51 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "config.h"
+#include "modules/compositorworker/CompositorWorkerGlobalScope.h"
+
+#include "bindings/core/v8/SerializedScriptValue.h"
+#include "core/workers/WorkerObjectProxy.h"
+#include "core/workers/WorkerThreadStartupData.h"
+#include "modules/EventTargetModules.h"
+#include "modules/compositorworker/CompositorWorkerThread.h"
+
+namespace blink {
+
+PassRefPtrWillBeRawPtr<CompositorWorkerGlobalScope> CompositorWorkerGlobalScope::create(CompositorWorkerThread* thread, PassOwnPtrWillBeRawPtr<WorkerThreadStartupData> startupData, double timeOrigin)
+{
+ RefPtrWillBeRawPtr<CompositorWorkerGlobalScope> context = adoptRefWillBeNoop(new CompositorWorkerGlobalScope(startupData->m_scriptURL, startupData->m_userAgent, thread, timeOrigin, startupData->m_starterOrigin, startupData->m_workerClients.release()));
+ context->applyContentSecurityPolicyFromString(startupData->m_contentSecurityPolicy, startupData->m_contentSecurityPolicyType);
+ return context.release();
+}
+
+CompositorWorkerGlobalScope::CompositorWorkerGlobalScope(const KURL& url, const String& userAgent, CompositorWorkerThread* thread, double timeOrigin, const SecurityOrigin* starterOrigin, PassOwnPtrWillBeRawPtr<WorkerClients> workerClients)
+ : WorkerGlobalScope(url, userAgent, thread, timeOrigin, starterOrigin, workerClients)
+{
+}
+
+CompositorWorkerGlobalScope::~CompositorWorkerGlobalScope()
+{
+}
+
+const AtomicString& CompositorWorkerGlobalScope::interfaceName() const
+{
+ return EventTargetNames::CompositorWorkerGlobalScope;
+}
+
+void CompositorWorkerGlobalScope::postMessage(ExecutionContext*, PassRefPtr<SerializedScriptValue> message, const MessagePortArray* ports, ExceptionState& exceptionState)
+{
+ // Disentangle the port in preparation for sending it to the remote context.
+ OwnPtr<MessagePortChannelArray> channels = MessagePort::disentanglePorts(ports, exceptionState);
+ if (exceptionState.hadException())
+ return;
+ thread()->workerObjectProxy().postMessageToWorkerObject(message, channels.release());
+}
+
+CompositorWorkerThread* CompositorWorkerGlobalScope::thread() const
+{
+ return static_cast<CompositorWorkerThread*>(WorkerGlobalScope::thread());
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698