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

Side by Side Diff: third_party/WebKit/Source/platform/scroll/ProgrammaticScrollAnimator.h

Issue 1477113003: [Oilpan] Move ScrollAnimators onto oilpan heap (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rename Created 5 years 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 ProgrammaticScrollAnimator_h 5 #ifndef ProgrammaticScrollAnimator_h
6 #define ProgrammaticScrollAnimator_h 6 #define ProgrammaticScrollAnimator_h
7 7
8 #include "platform/geometry/FloatPoint.h" 8 #include "platform/geometry/FloatPoint.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/Allocator.h" 12 #include "wtf/Allocator.h"
13 #include "wtf/Noncopyable.h" 13 #include "wtf/Noncopyable.h"
14 #include "wtf/OwnPtr.h" 14 #include "wtf/OwnPtr.h"
15 #include "wtf/PassOwnPtr.h" 15 #include "wtf/PassOwnPtr.h"
16 16
17 namespace blink { 17 namespace blink {
18 18
19 class ScrollableArea; 19 class ScrollableArea;
20 class WebCompositorAnimationPlayer; 20 class WebCompositorAnimationPlayer;
21 class WebCompositorAnimationTimeline; 21 class WebCompositorAnimationTimeline;
22 class WebScrollOffsetAnimationCurve; 22 class WebScrollOffsetAnimationCurve;
23 23
24 // Animator for fixed-destination scrolls, such as those triggered by 24 // Animator for fixed-destination scrolls, such as those triggered by
25 // CSSOM View scroll APIs. 25 // CSSOM View scroll APIs.
26 class ProgrammaticScrollAnimator : private WebCompositorAnimationPlayerClient, W ebCompositorAnimationDelegate { 26 class ProgrammaticScrollAnimator : public NoBaseWillBeGarbageCollectedFinalized< ProgrammaticScrollAnimator>, private WebCompositorAnimationPlayerClient, WebComp ositorAnimationDelegate {
27 WTF_MAKE_NONCOPYABLE(ProgrammaticScrollAnimator); 27 WTF_MAKE_NONCOPYABLE(ProgrammaticScrollAnimator);
28 USING_FAST_MALLOC(ProgrammaticScrollAnimator); 28 USING_FAST_MALLOC_WILL_BE_REMOVED(ProgrammaticScrollAnimator);
29 public: 29 public:
30 static PassOwnPtr<ProgrammaticScrollAnimator> create(ScrollableArea*); 30 static PassOwnPtrWillBeRawPtr<ProgrammaticScrollAnimator> create(ScrollableA rea*);
31 31
32 ~ProgrammaticScrollAnimator(); 32 virtual ~ProgrammaticScrollAnimator();
33 33
34 void scrollToOffsetWithoutAnimation(const FloatPoint&); 34 void scrollToOffsetWithoutAnimation(const FloatPoint&);
35 void animateToOffset(FloatPoint); 35 void animateToOffset(FloatPoint);
36 void cancelAnimation(); 36 void cancelAnimation();
37 void tickAnimation(double monotonicTime); 37 void tickAnimation(double monotonicTime);
38 bool hasAnimationThatRequiresService() const; 38 bool hasAnimationThatRequiresService() const;
39 void updateCompositorAnimations(); 39 void updateCompositorAnimations();
40 void layerForCompositedScrollingDidChange(WebCompositorAnimationTimeline*); 40 void layerForCompositedScrollingDidChange(WebCompositorAnimationTimeline*);
41 void notifyCompositorAnimationFinished(int groupId); 41 void notifyCompositorAnimationFinished(int groupId);
42 // WebCompositorAnimationDelegate implementation. 42 // WebCompositorAnimationDelegate implementation.
43 void notifyAnimationStarted(double monotonicTime, int group) override; 43 void notifyAnimationStarted(double monotonicTime, int group) override;
44 void notifyAnimationFinished(double monotonicTime, int group) override; 44 void notifyAnimationFinished(double monotonicTime, int group) override;
45 45
46 // WebCompositorAnimationPlayerClient implementation. 46 // WebCompositorAnimationPlayerClient implementation.
47 WebCompositorAnimationPlayer* compositorPlayer() const override; 47 WebCompositorAnimationPlayer* compositorPlayer() const override;
48 48
49 DECLARE_TRACE();
50
49 private: 51 private:
50 explicit ProgrammaticScrollAnimator(ScrollableArea*); 52 explicit ProgrammaticScrollAnimator(ScrollableArea*);
51 53
52 enum class RunState { 54 enum class RunState {
53 // No animation. 55 // No animation.
54 Idle, 56 Idle,
55 57
56 // Waiting to send an animation to the compositor. There might also 58 // Waiting to send an animation to the compositor. There might also
57 // already be another animation running on the compositor that will need 59 // already be another animation running on the compositor that will need
58 // to be canceled first. 60 // to be canceled first.
(...skipping 10 matching lines...) Expand all
69 WaitingToCancelOnCompositor 71 WaitingToCancelOnCompositor
70 }; 72 };
71 73
72 void resetAnimationState(); 74 void resetAnimationState();
73 void notifyPositionChanged(const DoublePoint&); 75 void notifyPositionChanged(const DoublePoint&);
74 void reattachCompositorPlayerIfNeeded(WebCompositorAnimationTimeline*); 76 void reattachCompositorPlayerIfNeeded(WebCompositorAnimationTimeline*);
75 77
76 OwnPtr<WebCompositorAnimationPlayer> m_compositorPlayer; 78 OwnPtr<WebCompositorAnimationPlayer> m_compositorPlayer;
77 int m_compositorAnimationAttachedToLayerId; 79 int m_compositorAnimationAttachedToLayerId;
78 80
79 GC_PLUGIN_IGNORE("509911") 81 RawPtrWillBeMember<ScrollableArea> m_scrollableArea;
80 ScrollableArea* m_scrollableArea;
81 OwnPtr<WebScrollOffsetAnimationCurve> m_animationCurve; 82 OwnPtr<WebScrollOffsetAnimationCurve> m_animationCurve;
82 FloatPoint m_targetOffset; 83 FloatPoint m_targetOffset;
83 double m_startTime; 84 double m_startTime;
84 RunState m_runState; 85 RunState m_runState;
85 int m_compositorAnimationId; 86 int m_compositorAnimationId;
86 int m_compositorAnimationGroupId; 87 int m_compositorAnimationGroupId;
87 }; 88 };
88 89
89 } // namespace blink 90 } // namespace blink
90 91
91 #endif // ProgrammaticScrollAnimator_h 92 #endif // ProgrammaticScrollAnimator_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698