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

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

Issue 2178223002: Refactor Worklet class to use ScriptResource (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: synced to the head Created 4 years, 4 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
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "modules/csspaint/PaintWorklet.h" 5 #include "modules/csspaint/PaintWorklet.h"
6 6
7 #include "bindings/core/v8/V8Binding.h" 7 #include "bindings/core/v8/V8Binding.h"
8 #include "core/dom/ExecutionContext.h"
9 #include "modules/csspaint/PaintWorkletGlobalScope.h" 8 #include "modules/csspaint/PaintWorkletGlobalScope.h"
10 9
11 namespace blink { 10 namespace blink {
12 11
13 // static 12 // static
14 PaintWorklet* PaintWorklet::create(LocalFrame* frame, ExecutionContext* executio nContext) 13 PaintWorklet* PaintWorklet::create(LocalFrame* frame)
15 { 14 {
16 PaintWorklet* worklet = new PaintWorklet(frame, executionContext); 15 PaintWorklet* worklet = new PaintWorklet(frame);
17 worklet->suspendIfNeeded(); 16 worklet->suspendIfNeeded();
18 return worklet; 17 return worklet;
19 } 18 }
20 19
21 PaintWorklet::PaintWorklet(LocalFrame* frame, ExecutionContext* executionContext ) 20 PaintWorklet::PaintWorklet(LocalFrame* frame)
22 : Worklet(executionContext) 21 : Worklet(frame)
23 , m_paintWorkletGlobalScope(PaintWorkletGlobalScope::create(frame, execution Context->url(), executionContext->userAgent(), executionContext->getSecurityOrig in(), toIsolate(executionContext))) 22 , m_paintWorkletGlobalScope(PaintWorkletGlobalScope::create(frame, frame->do cument()->url(), frame->document()->userAgent(), frame->document()->getSecurityO rigin(), toIsolate(frame->document())))
24 { 23 {
25 } 24 }
26 25
27 PaintWorklet::~PaintWorklet() 26 PaintWorklet::~PaintWorklet()
28 { 27 {
29 } 28 }
30 29
31 PaintWorkletGlobalScope* PaintWorklet::workletGlobalScopeProxy() const 30 PaintWorkletGlobalScope* PaintWorklet::workletGlobalScopeProxy() const
32 { 31 {
33 return m_paintWorkletGlobalScope.get(); 32 return m_paintWorkletGlobalScope.get();
34 } 33 }
35 34
36 CSSPaintDefinition* PaintWorklet::findDefinition(const String& name) 35 CSSPaintDefinition* PaintWorklet::findDefinition(const String& name)
37 { 36 {
38 return m_paintWorkletGlobalScope->findDefinition(name); 37 return m_paintWorkletGlobalScope->findDefinition(name);
39 } 38 }
40 39
41 void PaintWorklet::addPendingGenerator(const String& name, CSSPaintImageGenerato rImpl* generator) 40 void PaintWorklet::addPendingGenerator(const String& name, CSSPaintImageGenerato rImpl* generator)
42 { 41 {
43 return m_paintWorkletGlobalScope->addPendingGenerator(name, generator); 42 return m_paintWorkletGlobalScope->addPendingGenerator(name, generator);
44 } 43 }
45 44
46 DEFINE_TRACE(PaintWorklet) 45 DEFINE_TRACE(PaintWorklet)
47 { 46 {
48 visitor->trace(m_paintWorkletGlobalScope); 47 visitor->trace(m_paintWorkletGlobalScope);
49 Worklet::trace(visitor); 48 Worklet::trace(visitor);
50 } 49 }
51 50
52 } // namespace blink 51 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698