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

Side by Side Diff: third_party/WebKit/Source/web/AnimationWorkletProxyClientImpl.cpp

Issue 2894233002: [animation-worklet] invoke animate callback on mutation signal (Closed)
Patch Set: Created 3 years, 7 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
« no previous file with comments | « third_party/WebKit/Source/web/AnimationWorkletProxyClientImpl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "web/AnimationWorkletProxyClientImpl.h" 5 #include "web/AnimationWorkletProxyClientImpl.h"
6 6
7 #include "core/dom/CompositorProxy.h" 7 #include "core/dom/CompositorProxy.h"
8 #include "platform/graphics/CompositorMutableStateProvider.h" 8 #include "platform/graphics/CompositorMutableStateProvider.h"
9 #include "web/CompositorMutatorImpl.h" 9 #include "web/CompositorMutatorImpl.h"
10 10
11 namespace blink { 11 namespace blink {
12 12
13 AnimationWorkletProxyClientImpl::AnimationWorkletProxyClientImpl( 13 AnimationWorkletProxyClientImpl::AnimationWorkletProxyClientImpl(
14 CompositorMutatorImpl* mutator) 14 CompositorMutatorImpl* mutator)
15 : mutator_(mutator) { 15 : mutator_(mutator) {
16 DCHECK(IsMainThread()); 16 DCHECK(IsMainThread());
17 } 17 }
18 18
19 DEFINE_TRACE(AnimationWorkletProxyClientImpl) { 19 DEFINE_TRACE(AnimationWorkletProxyClientImpl) {
20 AnimationWorkletProxyClient::Trace(visitor); 20 AnimationWorkletProxyClient::Trace(visitor);
21 CompositorAnimator::Trace(visitor); 21 CompositorAnimator::Trace(visitor);
22 } 22 }
23 23
24 void AnimationWorkletProxyClientImpl::SetGlobalScope(
25 WorkletGlobalScope* scope) {
26 DCHECK(!IsMainThread());
27 DCHECK(scope);
28 global_scope_ = static_cast<AnimationWorkletGlobalScope*>(scope);
29 mutator_->RegisterCompositorAnimator(this);
30 }
31
32 void AnimationWorkletProxyClientImpl::Dispose() {
33 // At worklet scope termination break the reference cycle between
34 // CompositorMutatorImpl and AnimationProxyClientImpl and also the cycle
35 // between AnimationWorkletGlobalScope and AnimationWorkletProxyClientImpl.
36 mutator_->UnregisterCompositorAnimator(this);
37 global_scope_ = nullptr;
38 }
39
24 bool AnimationWorkletProxyClientImpl::Mutate( 40 bool AnimationWorkletProxyClientImpl::Mutate(
25 double monotonic_time_now, 41 double monotonic_time_now,
26 CompositorMutableStateProvider* provider) { 42 CompositorMutableStateProvider* provider) {
27 DCHECK(!IsMainThread()); 43 DCHECK(!IsMainThread());
28 // TODO(majidvp): actually call JS |animate| callbacks. 44 // TODO(majidvp): actually call JS |animate| callbacks.
29 45
46 if (global_scope_)
47 global_scope_->Mutate();
30 // Always request another rAF for now. 48 // Always request another rAF for now.
31 return true; 49 return true;
32 } 50 }
33 51
34 } // namespace blink 52 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/AnimationWorkletProxyClientImpl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698