| OLD | NEW |
| 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/worklet/DOMWindowWorklet.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/worklet/Worklet.h" | 9 #include "modules/csspaint/PaintWorklet.h" |
| 10 | 10 |
| 11 namespace blink { | 11 namespace blink { |
| 12 | 12 |
| 13 DOMWindowWorklet::DOMWindowWorklet(LocalDOMWindow& window) | 13 WindowPaintWorklet::WindowPaintWorklet(LocalDOMWindow& window) |
| 14 : DOMWindowProperty(window.frame()) | 14 : DOMWindowProperty(window.frame()) |
| 15 { | 15 { |
| 16 } | 16 } |
| 17 | 17 |
| 18 DEFINE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(DOMWindowWorklet); | 18 DEFINE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(WindowPaintWorklet); |
| 19 | 19 |
| 20 const char* DOMWindowWorklet::supplementName() | 20 const char* WindowPaintWorklet::supplementName() |
| 21 { | 21 { |
| 22 return "DOMWindowWorklet"; | 22 return "WindowPaintWorklet"; |
| 23 } | 23 } |
| 24 | 24 |
| 25 // static | 25 // static |
| 26 DOMWindowWorklet& DOMWindowWorklet::from(LocalDOMWindow& window) | 26 WindowPaintWorklet& WindowPaintWorklet::from(LocalDOMWindow& window) |
| 27 { | 27 { |
| 28 DOMWindowWorklet* supplement = static_cast<DOMWindowWorklet*>(WillBeHeapSupp
lement<LocalDOMWindow>::from(window, supplementName())); | 28 WindowPaintWorklet* supplement = static_cast<WindowPaintWorklet*>(WillBeHeap
Supplement<LocalDOMWindow>::from(window, supplementName())); |
| 29 if (!supplement) { | 29 if (!supplement) { |
| 30 supplement = new DOMWindowWorklet(window); | 30 supplement = new WindowPaintWorklet(window); |
| 31 provideTo(window, supplementName(), adoptPtrWillBeNoop(supplement)); | 31 provideTo(window, supplementName(), adoptPtrWillBeNoop(supplement)); |
| 32 } | 32 } |
| 33 return *supplement; | 33 return *supplement; |
| 34 } | 34 } |
| 35 | 35 |
| 36 // static | 36 // static |
| 37 Worklet* DOMWindowWorklet::renderWorklet(ExecutionContext* executionContext, DOM
Window& window) | 37 Worklet* WindowPaintWorklet::paintWorklet(ExecutionContext* executionContext, DO
MWindow& window) |
| 38 { | 38 { |
| 39 return from(toLocalDOMWindow(window)).renderWorklet(executionContext); | 39 return from(toLocalDOMWindow(window)).paintWorklet(executionContext); |
| 40 } | 40 } |
| 41 | 41 |
| 42 Worklet* DOMWindowWorklet::renderWorklet(ExecutionContext* executionContext) con
st | 42 PaintWorklet* WindowPaintWorklet::paintWorklet(ExecutionContext* executionContex
t) const |
| 43 { | 43 { |
| 44 if (!m_renderWorklet && frame()) | 44 if (!m_paintWorklet && frame()) |
| 45 m_renderWorklet = Worklet::create(frame(), executionContext); | 45 m_paintWorklet = PaintWorklet::create(frame(), executionContext); |
| 46 return m_renderWorklet.get(); | 46 return m_paintWorklet.get(); |
| 47 } | 47 } |
| 48 | 48 |
| 49 DEFINE_TRACE(DOMWindowWorklet) | 49 DEFINE_TRACE(WindowPaintWorklet) |
| 50 { | 50 { |
| 51 visitor->trace(m_renderWorklet); | 51 visitor->trace(m_paintWorklet); |
| 52 WillBeHeapSupplement<LocalDOMWindow>::trace(visitor); | 52 WillBeHeapSupplement<LocalDOMWindow>::trace(visitor); |
| 53 DOMWindowProperty::trace(visitor); | 53 DOMWindowProperty::trace(visitor); |
| 54 } | 54 } |
| 55 | 55 |
| 56 } // namespace blink | 56 } // namespace blink |
| OLD | NEW |