| 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/compositorworker/WindowAnimationWorklet.h" | 5 #include "modules/compositorworker/WindowAnimationWorklet.h" |
| 6 | 6 |
| 7 #include "core/dom/Document.h" | 7 #include "core/dom/Document.h" |
| 8 #include "core/frame/LocalDOMWindow.h" | 8 #include "core/frame/LocalDOMWindow.h" |
| 9 #include "core/frame/LocalFrame.h" | 9 #include "core/frame/LocalFrame.h" |
| 10 #include "modules/compositorworker/AnimationWorklet.h" | 10 #include "modules/compositorworker/AnimationWorklet.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 Supplement<LocalDOMWindow>::from(window, supplementName())); | 24 Supplement<LocalDOMWindow>::from(window, supplementName())); |
| 25 if (!supplement) { | 25 if (!supplement) { |
| 26 supplement = new WindowAnimationWorklet(window); | 26 supplement = new WindowAnimationWorklet(window); |
| 27 provideTo(window, supplementName(), supplement); | 27 provideTo(window, supplementName(), supplement); |
| 28 } | 28 } |
| 29 return *supplement; | 29 return *supplement; |
| 30 } | 30 } |
| 31 | 31 |
| 32 // static | 32 // static |
| 33 Worklet* WindowAnimationWorklet::animationWorklet(DOMWindow& window) { | 33 Worklet* WindowAnimationWorklet::animationWorklet(DOMWindow& window) { |
| 34 if (!window.frame()) |
| 35 return nullptr; |
| 34 return from(toLocalDOMWindow(window)) | 36 return from(toLocalDOMWindow(window)) |
| 35 .animationWorklet(toLocalDOMWindow(window)); | 37 .animationWorklet(toLocalDOMWindow(window)); |
| 36 } | 38 } |
| 37 | 39 |
| 38 AnimationWorklet* WindowAnimationWorklet::animationWorklet( | 40 AnimationWorklet* WindowAnimationWorklet::animationWorklet( |
| 39 LocalDOMWindow& window) { | 41 LocalDOMWindow& window) { |
| 40 if (!m_animationWorklet && getExecutionContext()) { | 42 if (!m_animationWorklet && getExecutionContext()) { |
| 41 DCHECK(window.frame()); | 43 DCHECK(window.frame()); |
| 42 m_animationWorklet = AnimationWorklet::create(window.frame()); | 44 m_animationWorklet = AnimationWorklet::create(window.frame()); |
| 43 } | 45 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 57 m_animationWorklet = nullptr; | 59 m_animationWorklet = nullptr; |
| 58 } | 60 } |
| 59 | 61 |
| 60 DEFINE_TRACE(WindowAnimationWorklet) { | 62 DEFINE_TRACE(WindowAnimationWorklet) { |
| 61 visitor->trace(m_animationWorklet); | 63 visitor->trace(m_animationWorklet); |
| 62 Supplement<LocalDOMWindow>::trace(visitor); | 64 Supplement<LocalDOMWindow>::trace(visitor); |
| 63 ContextLifecycleObserver::trace(visitor); | 65 ContextLifecycleObserver::trace(visitor); |
| 64 } | 66 } |
| 65 | 67 |
| 66 } // namespace blink | 68 } // namespace blink |
| OLD | NEW |