| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 ScrollAnimatorCompositorCoordinator_h | 5 #ifndef ScrollAnimatorCompositorCoordinator_h |
| 6 #define ScrollAnimatorCompositorCoordinator_h | 6 #define ScrollAnimatorCompositorCoordinator_h |
| 7 | 7 |
| 8 #include "platform/PlatformExport.h" | 8 #include "platform/PlatformExport.h" |
| 9 #include "platform/heap/Handle.h" | 9 #include "platform/heap/Handle.h" |
| 10 #include "public/platform/WebCompositorAnimationDelegate.h" | 10 #include "public/platform/WebCompositorAnimationDelegate.h" |
| 11 #include "public/platform/WebCompositorAnimationPlayerClient.h" | 11 #include "public/platform/WebCompositorAnimationPlayerClient.h" |
| 12 #include "wtf/OwnPtr.h" | 12 #include "wtf/OwnPtr.h" |
| 13 | 13 |
| 14 namespace blink { | 14 namespace blink { |
| 15 | 15 |
| 16 class ScrollableArea; | 16 class ScrollableArea; |
| 17 class WebCompositorAnimationPlayer; | 17 class WebCompositorAnimationPlayer; |
| 18 class WebCompositorAnimationTimeline; | 18 class WebCompositorAnimationTimeline; |
| 19 | 19 |
| 20 class PLATFORM_EXPORT ScrollAnimatorCompositorCoordinator : public NoBaseWillBeG
arbageCollectedFinalized<ScrollAnimatorCompositorCoordinator>, private WebCompos
itorAnimationPlayerClient, WebCompositorAnimationDelegate { | 20 class PLATFORM_EXPORT ScrollAnimatorCompositorCoordinator : public NoBaseWillBeG
arbageCollectedFinalized<ScrollAnimatorCompositorCoordinator>, private WebCompos
itorAnimationPlayerClient, WebCompositorAnimationDelegate { |
| 21 public: | 21 public: |
| 22 virtual ~ScrollAnimatorCompositorCoordinator(); | 22 virtual ~ScrollAnimatorCompositorCoordinator(); |
| 23 | 23 |
| 24 bool hasAnimationThatRequiresService() const; | 24 bool hasAnimationThatRequiresService() const; |
| 25 void cancelAnimation(); |
| 25 | 26 |
| 26 virtual void resetAnimationState(); | 27 virtual void resetAnimationState(); |
| 27 virtual void cancelAnimation(); | |
| 28 | 28 |
| 29 virtual ScrollableArea* scrollableArea() const = 0; | 29 virtual ScrollableArea* scrollableArea() const = 0; |
| 30 virtual void tickAnimation(double monotonicTime) = 0; | 30 virtual void tickAnimation(double monotonicTime) = 0; |
| 31 virtual void updateCompositorAnimations() = 0; | 31 virtual void updateCompositorAnimations() = 0; |
| 32 virtual void notifyCompositorAnimationFinished(int groupId) = 0; | 32 virtual void notifyCompositorAnimationFinished(int groupId) = 0; |
| 33 virtual void layerForCompositedScrollingDidChange(WebCompositorAnimationTime
line*) = 0; | 33 virtual void layerForCompositedScrollingDidChange(WebCompositorAnimationTime
line*) = 0; |
| 34 | 34 |
| 35 DEFINE_INLINE_VIRTUAL_TRACE() { } | 35 DEFINE_INLINE_VIRTUAL_TRACE() { } |
| 36 | 36 |
| 37 protected: | 37 protected: |
| 38 explicit ScrollAnimatorCompositorCoordinator(); | 38 explicit ScrollAnimatorCompositorCoordinator(); |
| 39 | 39 |
| 40 bool addAnimation(PassOwnPtr<WebCompositorAnimation>); | 40 bool addAnimation(PassOwnPtr<WebCompositorAnimation>); |
| 41 void removeAnimation(); | 41 void removeAnimation(); |
| 42 void abortAnimation(); | |
| 43 | 42 |
| 44 void compositorAnimationFinished(int groupId); | 43 void compositorAnimationFinished(int groupId); |
| 45 void reattachCompositorPlayerIfNeeded(WebCompositorAnimationTimeline*); | 44 void reattachCompositorPlayerIfNeeded(WebCompositorAnimationTimeline*); |
| 46 | 45 |
| 47 // WebCompositorAnimationDelegate implementation. | 46 // WebCompositorAnimationDelegate implementation. |
| 48 void notifyAnimationStarted(double monotonicTime, int group) override; | 47 void notifyAnimationStarted(double monotonicTime, int group) override; |
| 49 void notifyAnimationFinished(double monotonicTime, int group) override; | 48 void notifyAnimationFinished(double monotonicTime, int group) override; |
| 50 | 49 |
| 51 // WebCompositorAnimationPlayerClient implementation. | 50 // WebCompositorAnimationPlayerClient implementation. |
| 52 WebCompositorAnimationPlayer* compositorPlayer() const override; | 51 WebCompositorAnimationPlayer* compositorPlayer() const override; |
| 53 | 52 |
| 54 enum class RunState { | 53 enum class RunState { |
| 55 // No animation. | 54 // No animation. |
| 56 Idle, | 55 Idle, |
| 57 | 56 |
| 58 // Waiting to send an animation to the compositor. There might also | 57 // Waiting to send an animation to the compositor. There might also |
| 59 // already be another animation running on the compositor that will need | 58 // already be another animation running on the compositor that will need |
| 60 // to be canceled first. | 59 // to be canceled first. |
| 61 WaitingToSendToCompositor, | 60 WaitingToSendToCompositor, |
| 62 | 61 |
| 63 // Running an animation on the compositor. | 62 // Running an animation on the compositor. |
| 64 RunningOnCompositor, | 63 RunningOnCompositor, |
| 65 | 64 |
| 66 // Running an animation on the compositor but needs update. | |
| 67 RunningOnCompositorButNeedsUpdate, | |
| 68 | |
| 69 // Running an animation on the main thread. | 65 // Running an animation on the main thread. |
| 70 RunningOnMainThread, | 66 RunningOnMainThread, |
| 71 | 67 |
| 72 // Waiting to cancel the animation currently running on the compositor. | 68 // Waiting to cancel the animation currently running on the compositor. |
| 73 // There is no pending animation to replace the canceled animation. | 69 // There is no pending animation to replace the canceled animation. |
| 74 WaitingToCancelOnCompositor | 70 WaitingToCancelOnCompositor |
| 75 }; | 71 }; |
| 76 | 72 |
| 77 OwnPtr<WebCompositorAnimationPlayer> m_compositorPlayer; | 73 OwnPtr<WebCompositorAnimationPlayer> m_compositorPlayer; |
| 78 int m_compositorAnimationAttachedToLayerId; | 74 int m_compositorAnimationAttachedToLayerId; |
| 79 RunState m_runState; | 75 RunState m_runState; |
| 80 int m_compositorAnimationId; | 76 int m_compositorAnimationId; |
| 81 int m_compositorAnimationGroupId; | 77 int m_compositorAnimationGroupId; |
| 82 }; | 78 }; |
| 83 | 79 |
| 84 } // namespace blink | 80 } // namespace blink |
| 85 | 81 |
| 86 #endif // ScrollAnimatorCompositorCoordinator_h | 82 #endif // ScrollAnimatorCompositorCoordinator_h |
| OLD | NEW |