| Index: third_party/WebKit/Source/modules/compositorworker/WindowAnimationWorklet.cpp
|
| diff --git a/third_party/WebKit/Source/modules/compositorworker/WindowAnimationWorklet.cpp b/third_party/WebKit/Source/modules/compositorworker/WindowAnimationWorklet.cpp
|
| index 366d3a678f7c2f7b426fd56476a58596dd442741..70af55d7a1d7ce8381a7797605323ec11efcbfaa 100644
|
| --- a/third_party/WebKit/Source/modules/compositorworker/WindowAnimationWorklet.cpp
|
| +++ b/third_party/WebKit/Source/modules/compositorworker/WindowAnimationWorklet.cpp
|
| @@ -7,43 +7,15 @@
|
| #include "core/dom/Document.h"
|
| #include "core/frame/LocalDOMWindow.h"
|
| #include "core/frame/LocalFrame.h"
|
| -#include "modules/compositorworker/AnimationWorklet.h"
|
|
|
| namespace blink {
|
|
|
| -WindowAnimationWorklet::WindowAnimationWorklet(LocalDOMWindow& window)
|
| - : ContextLifecycleObserver(window.frame()->document()) {}
|
| -
|
| -const char* WindowAnimationWorklet::supplementName() {
|
| - return "WindowAnimationWorklet";
|
| -}
|
| -
|
| // static
|
| -WindowAnimationWorklet& WindowAnimationWorklet::from(LocalDOMWindow& window) {
|
| - WindowAnimationWorklet* supplement = static_cast<WindowAnimationWorklet*>(
|
| - Supplement<LocalDOMWindow>::from(window, supplementName()));
|
| - if (!supplement) {
|
| - supplement = new WindowAnimationWorklet(window);
|
| - provideTo(window, supplementName(), supplement);
|
| - }
|
| - return *supplement;
|
| -}
|
| -
|
| -// static
|
| -Worklet* WindowAnimationWorklet::animationWorklet(DOMWindow& window) {
|
| - if (!window.frame())
|
| - return nullptr;
|
| - return from(toLocalDOMWindow(window))
|
| - .animationWorklet(toLocalDOMWindow(window));
|
| -}
|
| -
|
| AnimationWorklet* WindowAnimationWorklet::animationWorklet(
|
| LocalDOMWindow& window) {
|
| - if (!m_animationWorklet && getExecutionContext()) {
|
| - DCHECK(window.frame());
|
| - m_animationWorklet = AnimationWorklet::create(window.frame());
|
| - }
|
| - return m_animationWorklet.get();
|
| + if (!window.frame())
|
| + return nullptr;
|
| + return from(window).m_animationWorklet.get();
|
| }
|
|
|
| // Break the following cycle when the context gets detached.
|
| @@ -65,4 +37,25 @@ DEFINE_TRACE(WindowAnimationWorklet) {
|
| ContextLifecycleObserver::trace(visitor);
|
| }
|
|
|
| +// static
|
| +WindowAnimationWorklet& WindowAnimationWorklet::from(LocalDOMWindow& window) {
|
| + WindowAnimationWorklet* supplement = static_cast<WindowAnimationWorklet*>(
|
| + Supplement<LocalDOMWindow>::from(window, supplementName()));
|
| + if (!supplement) {
|
| + supplement = new WindowAnimationWorklet(window);
|
| + provideTo(window, supplementName(), supplement);
|
| + }
|
| + return *supplement;
|
| +}
|
| +
|
| +WindowAnimationWorklet::WindowAnimationWorklet(LocalDOMWindow& window)
|
| + : ContextLifecycleObserver(window.frame()->document()),
|
| + m_animationWorklet(AnimationWorklet::create(window.frame())) {
|
| + DCHECK(getExecutionContext());
|
| +}
|
| +
|
| +const char* WindowAnimationWorklet::supplementName() {
|
| + return "WindowAnimationWorklet";
|
| +}
|
| +
|
| } // namespace blink
|
|
|