Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(78)

Side by Side Diff: third_party/WebKit/Source/modules/compositorworker/AnimationWorklet.cpp

Issue 2312493002: [worklets] Introduce ThreadedWorkletMessagingProxy and AnimationWorkletMessagaingProxy. (Closed)
Patch Set: rebase. Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/frame/LocalFrame.h" 9 #include "core/frame/LocalFrame.h"
9 #include "core/workers/ThreadedWorkletGlobalScopeProxy.h" 10 #include "modules/compositorworker/AnimationWorkletMessagingProxy.h"
11 #include "modules/compositorworker/AnimationWorkletThread.h"
10 12
11 namespace blink { 13 namespace blink {
12 14
13 // static 15 // static
14 AnimationWorklet* AnimationWorklet::create(LocalFrame* frame) 16 AnimationWorklet* AnimationWorklet::create(LocalFrame* frame)
15 { 17 {
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(nullptr)
24 { 26 {
25 } 27 }
26 28
27 AnimationWorklet::~AnimationWorklet() 29 AnimationWorklet::~AnimationWorklet()
28 { 30 {
31 if (m_workletMessagingProxy)
32 m_workletMessagingProxy->parentObjectDestroyed();
33 }
34
35 void AnimationWorklet::initialize()
36 {
37 AnimationWorkletThread::ensureSharedBackingThread();
38
39 DCHECK(!m_workletMessagingProxy);
40 DCHECK(getExecutionContext());
41
42 m_workletMessagingProxy = new AnimationWorkletMessagingProxy(getExecutionCon text());
43 m_workletMessagingProxy->initialize();
44 }
45
46 bool AnimationWorklet::isInitialized() const
47 {
48 return m_workletMessagingProxy;
29 } 49 }
30 50
31 WorkletGlobalScopeProxy* AnimationWorklet::workletGlobalScopeProxy() const 51 WorkletGlobalScopeProxy* AnimationWorklet::workletGlobalScopeProxy() const
32 { 52 {
33 return m_workletGlobalScopeProxy.get(); 53 DCHECK(m_workletMessagingProxy);
54 return m_workletMessagingProxy;
34 } 55 }
35 56
36 DEFINE_TRACE(AnimationWorklet) 57 DEFINE_TRACE(AnimationWorklet)
37 { 58 {
38 Worklet::trace(visitor); 59 Worklet::trace(visitor);
39 } 60 }
40 61
41 } // namespace blink 62 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698