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

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

Issue 2628323002: Remove DOMWindowProperty from WindowPaintWorklet (Closed)
Patch Set: Created 3 years, 11 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
« no previous file with comments | « third_party/WebKit/Source/modules/csspaint/WindowPaintWorklet.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/WindowPaintWorklet.h" 5 #include "modules/csspaint/WindowPaintWorklet.h"
6 6
7 #include "core/frame/LocalDOMWindow.h" 7 #include "core/frame/LocalDOMWindow.h"
8 #include "core/frame/LocalFrame.h" 8 #include "core/frame/LocalFrame.h"
9 #include "modules/csspaint/PaintWorklet.h" 9 #include "modules/csspaint/PaintWorklet.h"
10 10
11 namespace blink { 11 namespace blink {
12 12
13 WindowPaintWorklet::WindowPaintWorklet(LocalDOMWindow& window) 13 WindowPaintWorklet::WindowPaintWorklet(LocalDOMWindow& window)
14 : DOMWindowProperty(window.frame()) {} 14 : Supplement<LocalDOMWindow>(window) {}
15 15
16 const char* WindowPaintWorklet::supplementName() { 16 const char* WindowPaintWorklet::supplementName() {
17 return "WindowPaintWorklet"; 17 return "WindowPaintWorklet";
18 } 18 }
19 19
20 // static 20 // static
21 WindowPaintWorklet& WindowPaintWorklet::from(LocalDOMWindow& window) { 21 WindowPaintWorklet& WindowPaintWorklet::from(LocalDOMWindow& window) {
22 WindowPaintWorklet* supplement = static_cast<WindowPaintWorklet*>( 22 WindowPaintWorklet* supplement = static_cast<WindowPaintWorklet*>(
23 Supplement<LocalDOMWindow>::from(window, supplementName())); 23 Supplement<LocalDOMWindow>::from(window, supplementName()));
24 if (!supplement) { 24 if (!supplement) {
25 supplement = new WindowPaintWorklet(window); 25 supplement = new WindowPaintWorklet(window);
26 provideTo(window, supplementName(), supplement); 26 provideTo(window, supplementName(), supplement);
27 } 27 }
28 return *supplement; 28 return *supplement;
29 } 29 }
30 30
31 // static 31 // static
32 Worklet* WindowPaintWorklet::paintWorklet(DOMWindow& window) { 32 Worklet* WindowPaintWorklet::paintWorklet(DOMWindow& window) {
33 return from(toLocalDOMWindow(window)).paintWorklet(); 33 return from(toLocalDOMWindow(window)).paintWorklet();
34 } 34 }
35 35
36 PaintWorklet* WindowPaintWorklet::paintWorklet() { 36 PaintWorklet* WindowPaintWorklet::paintWorklet() {
37 if (!m_paintWorklet && frame()) 37 if (!m_paintWorklet && host() && host()->frame())
sof 2017/01/13 07:29:13 we really have to support operating in a host()-fr
38 m_paintWorklet = PaintWorklet::create(frame()); 38 m_paintWorklet = PaintWorklet::create(host()->frame());
39 return m_paintWorklet.get(); 39 return m_paintWorklet.get();
40 } 40 }
41 41
42 DEFINE_TRACE(WindowPaintWorklet) { 42 DEFINE_TRACE(WindowPaintWorklet) {
43 visitor->trace(m_paintWorklet); 43 visitor->trace(m_paintWorklet);
44 Supplement<LocalDOMWindow>::trace(visitor); 44 Supplement<LocalDOMWindow>::trace(visitor);
45 DOMWindowProperty::trace(visitor);
46 } 45 }
47 46
48 } // namespace blink 47 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/csspaint/WindowPaintWorklet.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698