| 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 "modules/compositorworker/AnimationWorkletGlobalScope.h" |
| 9 #include "platform/heap/Handle.h" | 10 #include "platform/heap/Handle.h" |
| 10 #include "platform/wtf/Noncopyable.h" | 11 #include "platform/wtf/Noncopyable.h" |
| 11 #include "web/CompositorAnimator.h" | 12 #include "web/CompositorAnimator.h" |
| 12 #include "web/CompositorProxyClientImpl.h" | 13 #include "web/CompositorProxyClientImpl.h" |
| 13 | 14 |
| 14 namespace blink { | 15 namespace blink { |
| 15 | 16 |
| 16 class CompositorMutatorImpl; | 17 class CompositorMutatorImpl; |
| 17 | 18 class WorkletGlobalScope; |
| 18 // Mediates between one Animator and the associated CompositorMutatorImpl. There | 19 // Mediates between one Animator and the associated CompositorMutatorImpl. There |
| 19 // is one AnimationWorkletProxyClientImpl per Animator but there may be multiple | 20 // is one AnimationWorkletProxyClientImpl per Animator but there may be multiple |
| 20 // for a given mutator and animatorWorklet. | 21 // for a given mutator and animatorWorklet. |
| 21 // | 22 // |
| 22 // This is constructed on the main thread but it is used in the worklet backing | 23 // This is constructed on the main thread but it is used in the worklet backing |
| 23 // thread i.e., compositor thread. | 24 // thread i.e., compositor thread. |
| 24 class AnimationWorkletProxyClientImpl final | 25 class AnimationWorkletProxyClientImpl final |
| 25 : public GarbageCollectedFinalized<AnimationWorkletProxyClientImpl>, | 26 : public GarbageCollectedFinalized<AnimationWorkletProxyClientImpl>, |
| 26 public AnimationWorkletProxyClient, | 27 public AnimationWorkletProxyClient, |
| 27 public CompositorAnimator { | 28 public CompositorAnimator { |
| 28 WTF_MAKE_NONCOPYABLE(AnimationWorkletProxyClientImpl); | 29 WTF_MAKE_NONCOPYABLE(AnimationWorkletProxyClientImpl); |
| 29 USING_GARBAGE_COLLECTED_MIXIN(AnimationWorkletProxyClientImpl); | 30 USING_GARBAGE_COLLECTED_MIXIN(AnimationWorkletProxyClientImpl); |
| 30 | 31 |
| 31 public: | 32 public: |
| 32 explicit AnimationWorkletProxyClientImpl(CompositorMutatorImpl*); | 33 explicit AnimationWorkletProxyClientImpl(CompositorMutatorImpl*); |
| 33 DECLARE_VIRTUAL_TRACE(); | 34 DECLARE_VIRTUAL_TRACE(); |
| 34 | 35 |
| 36 // AnimationWorkletProxyClient: |
| 37 void SetGlobalScope(WorkletGlobalScope*) override; |
| 38 void Dispose() override; |
| 39 |
| 35 // CompositorAnimator: | 40 // CompositorAnimator: |
| 36 // This method is invoked in compositor thread | 41 // This method is invoked in compositor thread |
| 37 bool Mutate(double monotonic_time_now, | 42 bool Mutate(double monotonic_time_now, |
| 38 CompositorMutableStateProvider*) override; | 43 CompositorMutableStateProvider*) override; |
| 39 | 44 |
| 45 CompositorProxyClient* GetCompositorProxyClient() override { |
| 46 return compositor_proxy_client_.Get(); |
| 47 }; |
| 48 |
| 40 private: | 49 private: |
| 41 CrossThreadPersistent<CompositorMutatorImpl> mutator_; | 50 CrossThreadPersistent<CompositorMutatorImpl> mutator_; |
| 42 | 51 |
| 43 CrossThreadPersistent<CompositorProxyClientImpl> compositor_proxy_client_; | 52 CrossThreadPersistent<CompositorProxyClientImpl> compositor_proxy_client_; |
| 53 |
| 54 CrossThreadPersistent<AnimationWorkletGlobalScope> global_scope_; |
| 44 }; | 55 }; |
| 45 | 56 |
| 46 } // namespace blink | 57 } // namespace blink |
| 47 | 58 |
| 48 #endif // AnimationWorkletProxyClientImpl_h | 59 #endif // AnimationWorkletProxyClientImpl_h |
| OLD | NEW |