Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(981)

Unified Diff: third_party/WebKit/Source/platform/scroll/ScrollAnimatorCompositorCoordinator.h

Issue 2336823003: Fix ScrollAnimator::hasRunningAnimation to account for the PostAnimationCleanup (Closed)
Patch Set: comment update Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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;

Powered by Google App Engine
This is Rietveld 408576698