Index: third_party/WebKit/Source/platform/scroll/ScrollAnimatorCompositorCoordinator.h |
diff --git a/third_party/WebKit/Source/platform/scroll/ScrollAnimatorCompositorCoordinator.h b/third_party/WebKit/Source/platform/scroll/ScrollAnimatorCompositorCoordinator.h |
index d893baf89fa51bc5427e92eda5d0f41a02d8a089..47e80017657ef2413fc5d816a17c7beef10123d9 100644 |
--- a/third_party/WebKit/Source/platform/scroll/ScrollAnimatorCompositorCoordinator.h |
+++ b/third_party/WebKit/Source/platform/scroll/ScrollAnimatorCompositorCoordinator.h |
@@ -30,6 +30,50 @@ class PLATFORM_EXPORT ScrollAnimatorCompositorCoordinator : public GarbageCollec |
WTF_MAKE_NONCOPYABLE(ScrollAnimatorCompositorCoordinator); |
USING_PRE_FINALIZER(ScrollAnimatorCompositorCoordinator, dispose); |
public: |
+ enum class RunState { |
+ // No animation. |
+ Idle, |
+ |
+ // Waiting to send an animation to the compositor. There might also |
+ // already be another animation running on the compositor that will need |
+ // to be canceled first. |
+ WaitingToSendToCompositor, |
+ |
+ // Running an animation on the compositor. |
+ RunningOnCompositor, |
+ |
+ // Running an animation on the compositor but needs update. |
+ RunningOnCompositorButNeedsUpdate, |
+ |
+ // Running an animation on the main thread. |
+ RunningOnMainThread, |
+ |
+ // Waiting to cancel the animation currently running on the compositor. |
+ // There is no pending animation to replace the canceled animation. |
+ WaitingToCancelOnCompositor, |
+ |
+ // Finished an animation that was running on the main thread or the |
+ // compositor thread. When in this state, post animation cleanup can |
+ // be performed. |
+ PostAnimationCleanup, |
+ |
+ // Running an animation on the compositor but need to continue it |
+ // on the main thread. This could happen if a main thread scrolling |
+ // reason is added while animating the scroll offset. |
+ RunningOnCompositorButNeedsTakeover, |
+ |
+ // Waiting to cancel the animation currently running on the compositor |
+ // while another animation is requested. In this case, the currently |
+ // running animation is aborted and an animation to the new target |
+ // from the current position is started. |
+ WaitingToCancelOnCompositorButNewScroll, |
+ |
+ // Running an animation on the compositor but an adjustment to the |
+ // scroll position was made on the main thread and the animation must |
+ // be updated. |
+ RunningOnCompositorButNeedsAdjustment, |
+ }; |
+ |
virtual ~ScrollAnimatorCompositorCoordinator(); |
bool hasAnimationThatRequiresService() const; |
@@ -55,6 +99,8 @@ public: |
virtual void notifyCompositorAnimationAborted(int groupId) = 0; |
virtual void layerForCompositedScrollingDidChange(CompositorAnimationTimeline*) = 0; |
+ RunState runStateForTesting() { return m_runState; } |
+ |
DEFINE_INLINE_VIRTUAL_TRACE() { } |
protected: |
@@ -90,57 +136,14 @@ protected: |
CompositorAnimationPlayer* compositorPlayer() const override; |
friend class Internals; |
- // TODO(ymalik): Tests are added as friends to access m_RunState. Expose |
- // it using ForTesting accessor or find a better way to test this. |
+ // TODO(ymalik): Tests are added as friends to access m_RunState. Use the |
+ // runStateForTesting accessor instead. |
FRIEND_TEST_ALL_PREFIXES(ScrollAnimatorTest, MainThreadStates); |
FRIEND_TEST_ALL_PREFIXES(ScrollAnimatorTest, AnimatedScrollTakeover); |
FRIEND_TEST_ALL_PREFIXES(ScrollAnimatorTest, CancellingAnimationResetsState); |
FRIEND_TEST_ALL_PREFIXES(ScrollAnimatorTest, CancellingCompositorAnimation); |
FRIEND_TEST_ALL_PREFIXES(ScrollAnimatorTest, ImplOnlyAnimationUpdatesCleared); |
- enum class RunState { |
- // No animation. |
- Idle, |
- |
- // Waiting to send an animation to the compositor. There might also |
- // already be another animation running on the compositor that will need |
- // to be canceled first. |
- WaitingToSendToCompositor, |
- |
- // Running an animation on the compositor. |
- RunningOnCompositor, |
- |
- // Running an animation on the compositor but needs update. |
- RunningOnCompositorButNeedsUpdate, |
- |
- // Running an animation on the main thread. |
- RunningOnMainThread, |
- |
- // Waiting to cancel the animation currently running on the compositor. |
- // There is no pending animation to replace the canceled animation. |
- WaitingToCancelOnCompositor, |
- |
- // Finished an animation that was running on the main thread or the |
- // compositor thread. When in this state, post animation cleanup can |
- // be performed. |
- PostAnimationCleanup, |
- |
- // Running an animation on the compositor but need to continue it |
- // on the main thread. This could happen if a main thread scrolling |
- // reason is added while animating the scroll offset. |
- RunningOnCompositorButNeedsTakeover, |
- |
- // Waiting to cancel the animation currently running on the compositor |
- // while another animation is requested. In this case, the currently |
- // running animation is aborted and an animation to the new target |
- // from the current position is started. |
- WaitingToCancelOnCompositorButNewScroll, |
- |
- // Running an animation on the compositor but an adjustment to the |
- // scroll position was made on the main thread and the animation must |
- // be updated. |
- RunningOnCompositorButNeedsAdjustment, |
- }; |
std::unique_ptr<CompositorAnimationPlayer> m_compositorPlayer; |
CompositorElementId m_compositorAnimationAttachedToElementId; |