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 #ifndef AnimationWorkletProxyClientImpl_h | 5 #ifndef AnimationWorkletProxyClientImpl_h |
6 #define AnimationWorkletProxyClientImpl_h | 6 #define AnimationWorkletProxyClientImpl_h |
7 | 7 |
8 #include "core/dom/AnimationWorkletProxyClient.h" | 8 #include "core/dom/AnimationWorkletProxyClient.h" |
9 #include "platform/heap/Handle.h" | 9 #include "platform/heap/Handle.h" |
10 #include "web/CompositorAnimator.h" | 10 #include "web/CompositorAnimator.h" |
| 11 #include "web/CompositorProxyClientImpl.h" |
11 #include "wtf/Noncopyable.h" | 12 #include "wtf/Noncopyable.h" |
12 | 13 |
13 namespace blink { | 14 namespace blink { |
14 | 15 |
15 class CompositorMutatorImpl; | 16 class CompositorMutatorImpl; |
16 | 17 |
17 // Mediates between one Animator and the associated CompositorMutatorImpl. There | 18 // Mediates between one Animator and the associated CompositorMutatorImpl. There |
18 // is one AnimationWorkletProxyClientImpl per Animator but there may be multiple | 19 // is one AnimationWorkletProxyClientImpl per Animator but there may be multiple |
19 // for a given mutator and animatorWorklet. | 20 // for a given mutator and animatorWorklet. |
20 // | 21 // |
21 // This is constructed on the main thread but it is used in the worklet backing | 22 // This is constructed on the main thread but it is used in the worklet backing |
22 // thread i.e., compositor thread. | 23 // thread i.e., compositor thread. |
23 class AnimationWorkletProxyClientImpl final | 24 class AnimationWorkletProxyClientImpl final |
24 : public AnimationWorkletProxyClient, | 25 : public GarbageCollectedFinalized<AnimationWorkletProxyClientImpl>, |
| 26 public AnimationWorkletProxyClient, |
25 public CompositorAnimator { | 27 public CompositorAnimator { |
26 WTF_MAKE_NONCOPYABLE(AnimationWorkletProxyClientImpl); | 28 WTF_MAKE_NONCOPYABLE(AnimationWorkletProxyClientImpl); |
27 USING_GARBAGE_COLLECTED_MIXIN(AnimationWorkletProxyClientImpl); | 29 USING_GARBAGE_COLLECTED_MIXIN(AnimationWorkletProxyClientImpl); |
28 | 30 |
29 public: | 31 public: |
30 explicit AnimationWorkletProxyClientImpl(CompositorMutatorImpl*); | 32 explicit AnimationWorkletProxyClientImpl(CompositorMutatorImpl*); |
31 DECLARE_VIRTUAL_TRACE(); | 33 DECLARE_VIRTUAL_TRACE(); |
32 | 34 |
33 // CompositorAnimator: | 35 // CompositorAnimator: |
34 // This method is invoked in compositor thread | 36 // This method is invoked in compositor thread |
35 bool mutate(double monotonicTimeNow, | 37 bool mutate(double monotonicTimeNow, |
36 CompositorMutableStateProvider*) override; | 38 CompositorMutableStateProvider*) override; |
37 | 39 |
38 // CompositorProxyClient: | |
39 void registerCompositorProxy(CompositorProxy*) override; | |
40 void unregisterCompositorProxy(CompositorProxy*) override; | |
41 | |
42 private: | 40 private: |
43 CrossThreadPersistent<CompositorMutatorImpl> m_mutator; | 41 CrossThreadPersistent<CompositorMutatorImpl> m_mutator; |
44 HeapHashSet<WeakMember<CompositorProxy>> m_proxies; | 42 |
| 43 CrossThreadPersistent<CompositorProxyClientImpl> m_compositorProxyClient; |
45 }; | 44 }; |
46 | 45 |
47 } // namespace blink | 46 } // namespace blink |
48 | 47 |
49 #endif // AnimationWorkletProxyClientImpl_h | 48 #endif // AnimationWorkletProxyClientImpl_h |
OLD | NEW |