OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 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 "modules/worklet/ThreadedWorkletGlobalScopeProxy.h" |
| 6 |
| 7 #include "bindings/core/v8/ScriptSourceCode.h" |
| 8 #include "bindings/core/v8/WorkerOrWorkletScriptController.h" |
| 9 #include "core/dom/CrossThreadTask.h" |
| 10 #include "core/dom/ExecutionContext.h" |
| 11 #include "core/workers/WorkletGlobalScope.h" |
| 12 #include "public/platform/WebTraceLocation.h" |
| 13 |
| 14 namespace blink { |
| 15 |
| 16 namespace { |
| 17 |
| 18 void processEvaluateScript(const String& source, const KURL& scriptURL, Executio
nContext* executionContext) |
| 19 { |
| 20 WorkletGlobalScope* globalScope = toWorkletGlobalScope(executionContext); |
| 21 globalScope->scriptController()->evaluate(ScriptSourceCode(source, scriptURL
)); |
| 22 } |
| 23 |
| 24 } // namespace |
| 25 |
| 26 ThreadedWorkletGlobalScopeProxy::ThreadedWorkletGlobalScopeProxy(PassOwnPtr<Work
letThread> workletThread) |
| 27 : m_workletThread(std::move(workletThread)) |
| 28 { |
| 29 } |
| 30 |
| 31 ThreadedWorkletGlobalScopeProxy::~ThreadedWorkletGlobalScopeProxy() |
| 32 { |
| 33 } |
| 34 |
| 35 void ThreadedWorkletGlobalScopeProxy::evaluateScript(const String& source, const
KURL& scriptURL) |
| 36 { |
| 37 DCHECK(isMainThread()); |
| 38 m_workletThread->postTask(BLINK_FROM_HERE, createCrossThreadTask(&processEva
luateScript, source, scriptURL)); |
| 39 } |
| 40 |
| 41 void ThreadedWorkletGlobalScopeProxy::terminateWorkletGlobalScope() |
| 42 { |
| 43 DCHECK(isMainThread()); |
| 44 |
| 45 // TODO write termination dance. |
| 46 } |
| 47 |
| 48 } // namespace blink |
OLD | NEW |