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

Side by Side Diff: third_party/WebKit/Source/modules/worklet/ThreadedWorkletGlobalScopeProxy.cpp

Issue 1992933002: Introduce WorkletGlobalScopeProxy interface. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix tests. Created 4 years, 6 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 unified diff | Download patch
OLDNEW
(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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698