| 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/AnimationWorklet.h" | 5 #include "modules/compositorworker/AnimationWorklet.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/V8Binding.h" | 7 #include "bindings/core/v8/V8Binding.h" |
| 8 #include "core/dom/Document.h" | 8 #include "core/dom/Document.h" |
| 9 #include "core/frame/LocalFrame.h" | 9 #include "core/frame/LocalFrame.h" |
| 10 #include "modules/compositorworker/AnimationWorkletMessagingProxy.h" | 10 #include "modules/compositorworker/AnimationWorkletMessagingProxy.h" |
| 11 #include "modules/compositorworker/AnimationWorkletThread.h" | 11 #include "modules/compositorworker/AnimationWorkletThread.h" |
| 12 | 12 |
| 13 namespace blink { | 13 namespace blink { |
| 14 | 14 |
| 15 // static | 15 // static |
| 16 AnimationWorklet* AnimationWorklet::create(LocalFrame* frame) { | 16 AnimationWorklet* AnimationWorklet::create(LocalFrame* frame) { |
| 17 AnimationWorklet* worklet = new AnimationWorklet(frame); | 17 return new AnimationWorklet(frame); |
| 18 worklet->suspendIfNeeded(); | |
| 19 return worklet; | |
| 20 } | 18 } |
| 21 | 19 |
| 22 AnimationWorklet::AnimationWorklet(LocalFrame* frame) | 20 AnimationWorklet::AnimationWorklet(LocalFrame* frame) |
| 23 : Worklet(frame), m_workletMessagingProxy(nullptr) {} | 21 : Worklet(frame), m_workletMessagingProxy(nullptr) {} |
| 24 | 22 |
| 25 AnimationWorklet::~AnimationWorklet() { | 23 AnimationWorklet::~AnimationWorklet() { |
| 26 if (m_workletMessagingProxy) | 24 if (m_workletMessagingProxy) |
| 27 m_workletMessagingProxy->parentObjectDestroyed(); | 25 m_workletMessagingProxy->parentObjectDestroyed(); |
| 28 } | 26 } |
| 29 | 27 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 45 WorkletGlobalScopeProxy* AnimationWorklet::workletGlobalScopeProxy() const { | 43 WorkletGlobalScopeProxy* AnimationWorklet::workletGlobalScopeProxy() const { |
| 46 DCHECK(m_workletMessagingProxy); | 44 DCHECK(m_workletMessagingProxy); |
| 47 return m_workletMessagingProxy; | 45 return m_workletMessagingProxy; |
| 48 } | 46 } |
| 49 | 47 |
| 50 DEFINE_TRACE(AnimationWorklet) { | 48 DEFINE_TRACE(AnimationWorklet) { |
| 51 Worklet::trace(visitor); | 49 Worklet::trace(visitor); |
| 52 } | 50 } |
| 53 | 51 |
| 54 } // namespace blink | 52 } // namespace blink |
| OLD | NEW |