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/frame/LocalFrame.h" | 8 #include "core/frame/LocalFrame.h" |
9 #include "core/workers/ThreadedWorkletGlobalScopeProxy.h" | 9 #include "modules/compositorworker/AnimationWorkletGlobalScopeProxy.h" |
| 10 #include "modules/compositorworker/AnimationWorkletThread.h" |
10 | 11 |
11 namespace blink { | 12 namespace blink { |
12 | 13 |
13 // static | 14 // static |
14 AnimationWorklet* AnimationWorklet::create(LocalFrame* frame) | 15 AnimationWorklet* AnimationWorklet::create(LocalFrame* frame) |
15 { | 16 { |
| 17 AnimationWorkletThread::ensureSharedBackingThread(); |
16 AnimationWorklet* worklet = new AnimationWorklet(frame); | 18 AnimationWorklet* worklet = new AnimationWorklet(frame); |
17 worklet->suspendIfNeeded(); | 19 worklet->suspendIfNeeded(); |
18 return worklet; | 20 return worklet; |
19 } | 21 } |
20 | 22 |
21 AnimationWorklet::AnimationWorklet(LocalFrame* frame) | 23 AnimationWorklet::AnimationWorklet(LocalFrame* frame) |
22 : Worklet(frame) | 24 : Worklet(frame) |
23 , m_workletGlobalScopeProxy(new ThreadedWorkletGlobalScopeProxy()) | 25 , m_workletMessagingProxy(new AnimationWorkletGlobalScopeProxy(frame)) |
24 { | 26 { |
| 27 m_workletMessagingProxy->initialize(); |
25 } | 28 } |
26 | 29 |
27 AnimationWorklet::~AnimationWorklet() | 30 AnimationWorklet::~AnimationWorklet() |
28 { | 31 { |
| 32 DCHECK(isMainThread()); |
| 33 m_workletMessagingProxy->workletObjectDestroyed(); |
29 } | 34 } |
30 | 35 |
31 WorkletGlobalScopeProxy* AnimationWorklet::workletGlobalScopeProxy() const | 36 WorkletGlobalScopeProxy* AnimationWorklet::workletGlobalScopeProxy() const |
32 { | 37 { |
33 return m_workletGlobalScopeProxy.get(); | 38 return m_workletMessagingProxy.get(); |
34 } | 39 } |
35 | 40 |
36 DEFINE_TRACE(AnimationWorklet) | 41 DEFINE_TRACE(AnimationWorklet) |
37 { | 42 { |
38 Worklet::trace(visitor); | 43 Worklet::trace(visitor); |
39 } | 44 } |
40 | 45 |
41 } // namespace blink | 46 } // namespace blink |
OLD | NEW |