Index: third_party/WebKit/Source/modules/worklet/ThreadedWorkletGlobalScopeProxy.cpp |
diff --git a/third_party/WebKit/Source/modules/worklet/ThreadedWorkletGlobalScopeProxy.cpp b/third_party/WebKit/Source/modules/worklet/ThreadedWorkletGlobalScopeProxy.cpp |
new file mode 100644 |
index 0000000000000000000000000000000000000000..4d28c64d9f8c441bc0b0cf53a9d7ddbd2cf767b5 |
--- /dev/null |
+++ b/third_party/WebKit/Source/modules/worklet/ThreadedWorkletGlobalScopeProxy.cpp |
@@ -0,0 +1,48 @@ |
+// 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 "modules/worklet/ThreadedWorkletGlobalScopeProxy.h" |
+ |
+#include "bindings/core/v8/ScriptSourceCode.h" |
+#include "bindings/core/v8/WorkerOrWorkletScriptController.h" |
+#include "core/dom/CrossThreadTask.h" |
+#include "core/dom/ExecutionContext.h" |
+#include "core/workers/WorkletGlobalScope.h" |
+#include "public/platform/WebTraceLocation.h" |
+ |
+namespace blink { |
+ |
+namespace { |
+ |
+void processEvaluateScript(const String& source, const KURL& scriptURL, ExecutionContext* executionContext) |
+{ |
+ WorkletGlobalScope* globalScope = toWorkletGlobalScope(executionContext); |
+ globalScope->scriptController()->evaluate(ScriptSourceCode(source, scriptURL)); |
+} |
+ |
+} // namespace |
+ |
+ThreadedWorkletGlobalScopeProxy::ThreadedWorkletGlobalScopeProxy(PassOwnPtr<WorkletThread> workletThread) |
+ : m_workletThread(std::move(workletThread)) |
+{ |
+} |
+ |
+ThreadedWorkletGlobalScopeProxy::~ThreadedWorkletGlobalScopeProxy() |
+{ |
+} |
+ |
+void ThreadedWorkletGlobalScopeProxy::evaluateScript(const String& source, const KURL& scriptURL) |
+{ |
+ DCHECK(isMainThread()); |
+ m_workletThread->postTask(BLINK_FROM_HERE, createCrossThreadTask(&processEvaluateScript, source, scriptURL)); |
+} |
+ |
+void ThreadedWorkletGlobalScopeProxy::terminateWorkletGlobalScope() |
+{ |
+ DCHECK(isMainThread()); |
+ |
+ // TODO write termination dance. |
+} |
+ |
+} // namespace blink |