| 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/csspaint/WindowPaintWorklet.h" | 5 #include "modules/compositorworker/WindowAnimationWorklet.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/compositorworker/AnimationWorklet.h" |
| 10 | 10 |
| 11 namespace blink { | 11 namespace blink { |
| 12 | 12 |
| 13 WindowPaintWorklet::WindowPaintWorklet(LocalDOMWindow& window) | 13 WindowAnimationWorklet::WindowAnimationWorklet(LocalDOMWindow& window) |
| 14 : DOMWindowProperty(window.frame()) | 14 : DOMWindowProperty(window.frame()) |
| 15 { | 15 { |
| 16 } | 16 } |
| 17 | 17 |
| 18 const char* WindowPaintWorklet::supplementName() | 18 const char* WindowAnimationWorklet::supplementName() |
| 19 { | 19 { |
| 20 return "WindowPaintWorklet"; | 20 return "WindowAnimationWorklet"; |
| 21 } | 21 } |
| 22 | 22 |
| 23 // static | 23 // static |
| 24 WindowPaintWorklet& WindowPaintWorklet::from(LocalDOMWindow& window) | 24 WindowAnimationWorklet& WindowAnimationWorklet::from(LocalDOMWindow& window) |
| 25 { | 25 { |
| 26 WindowPaintWorklet* supplement = static_cast<WindowPaintWorklet*>(Supplement
<LocalDOMWindow>::from(window, supplementName())); | 26 WindowAnimationWorklet* supplement = static_cast<WindowAnimationWorklet*>(Su
pplement<LocalDOMWindow>::from(window, supplementName())); |
| 27 if (!supplement) { | 27 if (!supplement) { |
| 28 supplement = new WindowPaintWorklet(window); | 28 supplement = new WindowAnimationWorklet(window); |
| 29 provideTo(window, supplementName(), supplement); | 29 provideTo(window, supplementName(), supplement); |
| 30 } | 30 } |
| 31 return *supplement; | 31 return *supplement; |
| 32 } | 32 } |
| 33 | 33 |
| 34 // static | 34 // static |
| 35 Worklet* WindowPaintWorklet::paintWorklet(ExecutionContext* executionContext, DO
MWindow& window) | 35 Worklet* WindowAnimationWorklet::animationWorklet(ExecutionContext* executionCon
text, DOMWindow& window) |
| 36 { | 36 { |
| 37 return from(toLocalDOMWindow(window)).paintWorklet(executionContext); | 37 return from(toLocalDOMWindow(window)).animationWorklet(executionContext); |
| 38 } | 38 } |
| 39 | 39 |
| 40 PaintWorklet* WindowPaintWorklet::paintWorklet(ExecutionContext* executionContex
t) const | 40 AnimationWorklet* WindowAnimationWorklet::animationWorklet(ExecutionContext* exe
cutionContext) |
| 41 { | 41 { |
| 42 if (!m_paintWorklet && frame()) | 42 if (!m_animationWorklet) |
| 43 m_paintWorklet = PaintWorklet::create(frame(), executionContext); | 43 m_animationWorklet = AnimationWorklet::create(executionContext); |
| 44 return m_paintWorklet.get(); | 44 return m_animationWorklet.get(); |
| 45 } | 45 } |
| 46 | 46 |
| 47 DEFINE_TRACE(WindowPaintWorklet) | 47 DEFINE_TRACE(WindowAnimationWorklet) |
| 48 { | 48 { |
| 49 visitor->trace(m_paintWorklet); | 49 visitor->trace(m_animationWorklet); |
| 50 Supplement<LocalDOMWindow>::trace(visitor); | 50 Supplement<LocalDOMWindow>::trace(visitor); |
| 51 DOMWindowProperty::trace(visitor); | 51 DOMWindowProperty::trace(visitor); |
| 52 } | 52 } |
| 53 | 53 |
| 54 } // namespace blink | 54 } // namespace blink |
| OLD | NEW |