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

Side by Side Diff: third_party/WebKit/Source/modules/csspaint/PaintWorkletGlobalScopeProxy.cpp

Issue 2853743002: Worklet: Introduce PaintWorkletGlobalScopeProxy (Closed)
Patch Set: address review comments Created 3 years, 7 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 2017 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/csspaint/PaintWorkletGlobalScopeProxy.h"
6
7 #include "bindings/core/v8/ScriptSourceCode.h"
8 #include "bindings/core/v8/V8BindingForCore.h"
9 #include "core/dom/Document.h"
10 #include "core/frame/LocalFrame.h"
11 #include "platform/weborigin/KURL.h"
12 #include "platform/wtf/WTF.h"
13
14 namespace blink {
15
16 std::unique_ptr<PaintWorkletGlobalScopeProxy>
17 PaintWorkletGlobalScopeProxy::Create(LocalFrame* frame) {
18 return WTF::WrapUnique(new PaintWorkletGlobalScopeProxy(frame));
haraken 2017/05/01 08:43:46 MakeUnique
nhiroki 2017/05/02 04:45:24 To change this to MakeUnique, we need to make the
19 }
20
21 PaintWorkletGlobalScopeProxy* PaintWorkletGlobalScopeProxy::From(
22 WorkletGlobalScopeProxy* proxy) {
23 return static_cast<PaintWorkletGlobalScopeProxy*>(proxy);
24 }
25
26 void PaintWorkletGlobalScopeProxy::FetchAndInvokeScript(
27 const KURL& module_url_record,
28 WorkletPendingTasks* pending_tasks) {
29 DCHECK(WTF::IsMainThread());
haraken 2017/05/01 08:43:46 WTF:: wouldn't be needed.
nhiroki 2017/05/02 04:45:24 Done.
30 global_scope_->FetchAndInvokeScript(module_url_record, pending_tasks);
haraken 2017/05/01 08:43:47 Just to confirm: You can simply redirect the metho
nhiroki 2017/05/02 04:45:24 Yes, that's right. For other threaded worklets, t
31 }
32
33 void PaintWorkletGlobalScopeProxy::EvaluateScript(
34 const ScriptSourceCode& script_source_code) {
35 // This should be called only for threaded worklets that still use classic
36 // script loading.
37 NOTREACHED();
38 }
39
40 void PaintWorkletGlobalScopeProxy::TerminateWorkletGlobalScope() {
41 DCHECK(WTF::IsMainThread());
42 global_scope_->Terminate();
43 }
44
45 CSSPaintDefinition* PaintWorkletGlobalScopeProxy::FindDefinition(
46 const String& name) {
47 DCHECK(WTF::IsMainThread());
48 return global_scope_->FindDefinition(name);
49 }
50
51 void PaintWorkletGlobalScopeProxy::AddPendingGenerator(
52 const String& name,
53 CSSPaintImageGeneratorImpl* generator) {
54 DCHECK(WTF::IsMainThread());
55 global_scope_->AddPendingGenerator(name, generator);
56 }
57
58 PaintWorkletGlobalScopeProxy::PaintWorkletGlobalScopeProxy(LocalFrame* frame) {
59 DCHECK(WTF::IsMainThread());
60 Document* document = frame->GetDocument();
61 global_scope_ = PaintWorkletGlobalScope::Create(
62 frame, document->Url(), document->UserAgent(),
63 document->GetSecurityOrigin(), ToIsolate(document));
64 }
65
66 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698