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

Unified Diff: third_party/WebKit/Source/core/workers/ThreadedWorkletObjectProxy.cpp

Issue 2312493002: [worklets] Introduce ThreadedWorkletMessagingProxy and AnimationWorkletMessagaingProxy. (Closed)
Patch Set: rebase. Created 4 years, 3 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: third_party/WebKit/Source/core/workers/ThreadedWorkletObjectProxy.cpp
diff --git a/third_party/WebKit/Source/core/workers/ThreadedWorkletObjectProxy.cpp b/third_party/WebKit/Source/core/workers/ThreadedWorkletObjectProxy.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..2643832a0ed9de03efd1c82d87da0fc19482a74c
--- /dev/null
+++ b/third_party/WebKit/Source/core/workers/ThreadedWorkletObjectProxy.cpp
@@ -0,0 +1,64 @@
+// Copyright 2016 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 "core/workers/ThreadedWorkletObjectProxy.h"
+
+#include "bindings/core/v8/SerializedScriptValue.h"
+#include "bindings/core/v8/SourceLocation.h"
+#include "core/dom/Document.h"
+#include "core/dom/ExecutionContext.h"
+#include "core/dom/ExecutionContextTask.h"
+#include "core/inspector/ConsoleMessage.h"
+#include "core/workers/ThreadedWorkletMessagingProxy.h"
+#include "wtf/Functional.h"
+#include "wtf/PtrUtil.h"
+#include <memory>
+
+namespace blink {
+
+std::unique_ptr<ThreadedWorkletObjectProxy> ThreadedWorkletObjectProxy::create(ThreadedWorkletMessagingProxy* messagingProxy)
+{
+ DCHECK(messagingProxy);
+ return wrapUnique(new ThreadedWorkletObjectProxy(messagingProxy));
+}
+
+void ThreadedWorkletObjectProxy::postTaskToMainExecutionContext(std::unique_ptr<ExecutionContextTask> task)
+{
+ getExecutionContext()->postTask(BLINK_FROM_HERE, std::move(task));
+}
+
+void ThreadedWorkletObjectProxy::reportConsoleMessage(MessageSource source, MessageLevel level, const String& message, SourceLocation* location)
+{
+ getExecutionContext()->postTask(BLINK_FROM_HERE, createCrossThreadTask(&::blink::ThreadedWorkletMessagingProxy::reportConsoleMessage, crossThreadUnretained(m_messagingProxy), source, level, message, passed(location->clone())));
+}
+
+void ThreadedWorkletObjectProxy::postMessageToPageInspector(const String& message)
+{
+ DCHECK(getExecutionContext()->isDocument());
+ toDocument(getExecutionContext())->postInspectorTask(BLINK_FROM_HERE, createCrossThreadTask(&::blink::ThreadedWorkletMessagingProxy::postMessageToPageInspector, crossThreadUnretained(m_messagingProxy), message));
+}
+
+void ThreadedWorkletObjectProxy::didCloseWorkerGlobalScope()
+{
+ getExecutionContext()->postTask(BLINK_FROM_HERE, createCrossThreadTask(&::blink::ThreadedWorkletMessagingProxy::terminateGlobalScope, crossThreadUnretained(m_messagingProxy)));
+}
+
+void ThreadedWorkletObjectProxy::didTerminateWorkerThread()
+{
+ // This will terminate the MessagingProxy.
+ getExecutionContext()->postTask(BLINK_FROM_HERE, createCrossThreadTask(&ThreadedWorkletMessagingProxy::workerThreadTerminated, crossThreadUnretained(m_messagingProxy)));
+}
+
+ThreadedWorkletObjectProxy::ThreadedWorkletObjectProxy(ThreadedWorkletMessagingProxy* messagingProxy)
+ : m_messagingProxy(messagingProxy)
+{
+}
+
+ExecutionContext* ThreadedWorkletObjectProxy::getExecutionContext() const
+{
+ DCHECK(m_messagingProxy);
+ return m_messagingProxy->getExecutionContext();
+}
+
+} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/workers/ThreadedWorkletObjectProxy.h ('k') | third_party/WebKit/Source/core/workers/Worklet.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698