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

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

Issue 2515363002: Introduce AnimationWorkletProxyClient and necessary plumbing to get it in worklet messaging proxy. (Closed)
Patch Set: Remove unnecessary PLATFORM_EXPORT Created 3 years, 10 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/AnimationWorkletProxyClient.h"
8 #include "core/dom/Document.h" 9 #include "core/dom/Document.h"
9 #include "core/frame/LocalFrame.h" 10 #include "core/frame/LocalFrame.h"
11 #include "core/page/ChromeClient.h"
10 #include "modules/compositorworker/AnimationWorkletMessagingProxy.h" 12 #include "modules/compositorworker/AnimationWorkletMessagingProxy.h"
11 #include "modules/compositorworker/AnimationWorkletThread.h" 13 #include "modules/compositorworker/AnimationWorkletThread.h"
12 14
13 namespace blink { 15 namespace blink {
14 16
15 // static 17 // static
16 AnimationWorklet* AnimationWorklet::create(LocalFrame* frame) { 18 AnimationWorklet* AnimationWorklet::create(LocalFrame* frame) {
17 return new AnimationWorklet(frame); 19 return new AnimationWorklet(frame);
18 } 20 }
19 21
20 AnimationWorklet::AnimationWorklet(LocalFrame* frame) 22 AnimationWorklet::AnimationWorklet(LocalFrame* frame)
21 : Worklet(frame), m_workletMessagingProxy(nullptr) {} 23 : Worklet(frame), m_workletMessagingProxy(nullptr) {}
22 24
23 AnimationWorklet::~AnimationWorklet() { 25 AnimationWorklet::~AnimationWorklet() {
24 if (m_workletMessagingProxy) 26 if (m_workletMessagingProxy)
25 m_workletMessagingProxy->parentObjectDestroyed(); 27 m_workletMessagingProxy->parentObjectDestroyed();
26 } 28 }
27 29
28 void AnimationWorklet::initialize() { 30 void AnimationWorklet::initialize() {
29 AnimationWorkletThread::ensureSharedBackingThread(); 31 AnimationWorkletThread::ensureSharedBackingThread();
30 32
31 DCHECK(!m_workletMessagingProxy); 33 DCHECK(!m_workletMessagingProxy);
32 DCHECK(getExecutionContext()); 34 DCHECK(getExecutionContext());
35 Document* document = toDocument(getExecutionContext());
36 AnimationWorkletProxyClient* proxyClient =
37 document->frame()->chromeClient().createAnimationWorkletProxyClient(
38 document->frame());
33 39
34 m_workletMessagingProxy = 40 m_workletMessagingProxy =
35 new AnimationWorkletMessagingProxy(getExecutionContext()); 41 new AnimationWorkletMessagingProxy(getExecutionContext(), proxyClient);
36 m_workletMessagingProxy->initialize(); 42 m_workletMessagingProxy->initialize();
37 } 43 }
38 44
39 bool AnimationWorklet::isInitialized() const { 45 bool AnimationWorklet::isInitialized() const {
40 return m_workletMessagingProxy; 46 return m_workletMessagingProxy;
41 } 47 }
42 48
43 WorkletGlobalScopeProxy* AnimationWorklet::workletGlobalScopeProxy() const { 49 WorkletGlobalScopeProxy* AnimationWorklet::workletGlobalScopeProxy() const {
44 DCHECK(m_workletMessagingProxy); 50 DCHECK(m_workletMessagingProxy);
45 return m_workletMessagingProxy; 51 return m_workletMessagingProxy;
46 } 52 }
47 53
48 DEFINE_TRACE(AnimationWorklet) { 54 DEFINE_TRACE(AnimationWorklet) {
49 Worklet::trace(visitor); 55 Worklet::trace(visitor);
50 } 56 }
51 57
52 } // namespace blink 58 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698