| 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 AnimationWorkletProxyClient, |
| 25 public CompositorAnimator { | 26 public CompositorAnimator { |
| 26 WTF_MAKE_NONCOPYABLE(AnimationWorkletProxyClientImpl); | 27 WTF_MAKE_NONCOPYABLE(AnimationWorkletProxyClientImpl); |
| 27 USING_GARBAGE_COLLECTED_MIXIN(AnimationWorkletProxyClientImpl); | 28 USING_GARBAGE_COLLECTED_MIXIN(AnimationWorkletProxyClientImpl); |
| 28 | 29 |
| 29 public: | 30 public: |
| 30 explicit AnimationWorkletProxyClientImpl(CompositorMutatorImpl*); | 31 explicit AnimationWorkletProxyClientImpl(CompositorMutatorImpl*); |
| 31 DECLARE_VIRTUAL_TRACE(); | 32 DECLARE_VIRTUAL_TRACE(); |
| 32 | 33 |
| 33 // CompositorAnimator: | 34 // CompositorAnimator: |
| 34 // This method is invoked in compositor thread | 35 // This method is invoked in compositor thread |
| 35 bool mutate(double monotonicTimeNow, | 36 bool mutate(double monotonicTimeNow, |
| 36 CompositorMutableStateProvider*) override; | 37 CompositorMutableStateProvider*) override; |
| 37 | 38 |
| 38 // CompositorProxyClient: | |
| 39 void registerCompositorProxy(CompositorProxy*) override; | |
| 40 void unregisterCompositorProxy(CompositorProxy*) override; | |
| 41 | |
| 42 private: | 39 private: |
| 43 CrossThreadPersistent<CompositorMutatorImpl> m_mutator; | 40 CrossThreadPersistent<CompositorMutatorImpl> m_mutator; |
| 44 HeapHashSet<WeakMember<CompositorProxy>> m_proxies; | 41 |
| 42 CrossThreadPersistent<CompositorProxyClientImpl> m_compositorProxyClient; |
| 45 }; | 43 }; |
| 46 | 44 |
| 47 } // namespace blink | 45 } // namespace blink |
| 48 | 46 |
| 49 #endif // AnimationWorkletProxyClientImpl_h | 47 #endif // AnimationWorkletProxyClientImpl_h |
| OLD | NEW |