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 CompositorAnimationPlayer_h | 5 #ifndef CompositorAnimationPlayer_h |
6 #define CompositorAnimationPlayer_h | 6 #define CompositorAnimationPlayer_h |
7 | 7 |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "cc/animation/animation.h" | |
10 #include "cc/animation/animation_curve.h" | |
11 #include "cc/animation/animation_delegate.h" | 9 #include "cc/animation/animation_delegate.h" |
12 #include "cc/animation/animation_player.h" | 10 #include "cc/animation/animation_player.h" |
13 #include "platform/PlatformExport.h" | 11 #include "platform/PlatformExport.h" |
14 #include "platform/graphics/CompositorElementId.h" | 12 #include "platform/graphics/CompositorElementId.h" |
15 #include "wtf/Noncopyable.h" | 13 #include "wtf/Noncopyable.h" |
16 #include "wtf/PtrUtil.h" | 14 #include "wtf/PtrUtil.h" |
17 #include <memory> | 15 #include <memory> |
18 | 16 |
| 17 namespace cc { |
| 18 class AnimationCurve; |
| 19 } |
| 20 |
19 namespace blink { | 21 namespace blink { |
20 | 22 |
21 class CompositorAnimation; | 23 class CompositorAnimation; |
22 class CompositorAnimationDelegate; | 24 class CompositorAnimationDelegate; |
23 class WebLayer; | |
24 | 25 |
25 // A compositor representation for AnimationPlayer. | 26 // A compositor representation for AnimationPlayer. |
26 class PLATFORM_EXPORT CompositorAnimationPlayer : public cc::AnimationDelegate { | 27 class PLATFORM_EXPORT CompositorAnimationPlayer : public cc::AnimationDelegate { |
27 WTF_MAKE_NONCOPYABLE(CompositorAnimationPlayer); | 28 WTF_MAKE_NONCOPYABLE(CompositorAnimationPlayer); |
28 public: | 29 public: |
29 static std::unique_ptr<CompositorAnimationPlayer> create() | 30 static std::unique_ptr<CompositorAnimationPlayer> create() |
30 { | 31 { |
31 return wrapUnique(new CompositorAnimationPlayer()); | 32 return wrapUnique(new CompositorAnimationPlayer()); |
32 } | 33 } |
33 | 34 |
34 ~CompositorAnimationPlayer(); | 35 ~CompositorAnimationPlayer(); |
35 | 36 |
36 cc::AnimationPlayer* animationPlayer() const; | 37 cc::AnimationPlayer* ccAnimationPlayer() const; |
37 | 38 |
38 // An animation delegate is notified when animations are started and | 39 // An animation delegate is notified when animations are started and |
39 // stopped. The CompositorAnimationPlayer does not take ownership of the del
egate, and it is | 40 // stopped. The CompositorAnimationPlayer does not take ownership of the del
egate, and it is |
40 // the responsibility of the client to reset the layer's delegate before | 41 // the responsibility of the client to reset the layer's delegate before |
41 // deleting the delegate. | 42 // deleting the delegate. |
42 void setAnimationDelegate(CompositorAnimationDelegate*); | 43 void setAnimationDelegate(CompositorAnimationDelegate*); |
43 | 44 |
44 void attachElement(const CompositorElementId&); | 45 void attachElement(const CompositorElementId&); |
45 void detachElement(); | 46 void detachElement(); |
46 bool isElementAttached() const; | 47 bool isElementAttached() const; |
47 | 48 |
48 void addAnimation(CompositorAnimation*); | 49 void addAnimation(std::unique_ptr<CompositorAnimation>); |
49 void removeAnimation(uint64_t animationId); | 50 void removeAnimation(int animationId); |
50 void pauseAnimation(uint64_t animationId, double timeOffset); | 51 void pauseAnimation(int animationId, double timeOffset); |
51 void abortAnimation(uint64_t animationId); | 52 void abortAnimation(int animationId); |
52 | 53 |
53 private: | 54 private: |
54 CompositorAnimationPlayer(); | 55 CompositorAnimationPlayer(); |
55 | 56 |
56 // cc::AnimationDelegate implementation. | 57 // cc::AnimationDelegate implementation. |
57 void NotifyAnimationStarted(base::TimeTicks monotonicTime, cc::TargetPropert
y::Type, int group) override; | 58 void NotifyAnimationStarted(base::TimeTicks monotonicTime, cc::TargetPropert
y::Type, int group) override; |
58 void NotifyAnimationFinished(base::TimeTicks monotonicTime, cc::TargetProper
ty::Type, int group) override; | 59 void NotifyAnimationFinished(base::TimeTicks monotonicTime, cc::TargetProper
ty::Type, int group) override; |
59 void NotifyAnimationAborted(base::TimeTicks monotonicTime, cc::TargetPropert
y::Type, int group) override; | 60 void NotifyAnimationAborted(base::TimeTicks monotonicTime, cc::TargetPropert
y::Type, int group) override; |
60 void NotifyAnimationTakeover(base::TimeTicks monotonicTime, cc::TargetProper
ty::Type, double animationStartTime, std::unique_ptr<cc::AnimationCurve>) overri
de; | 61 void NotifyAnimationTakeover(base::TimeTicks monotonicTime, cc::TargetProper
ty::Type, double animationStartTime, std::unique_ptr<cc::AnimationCurve>) overri
de; |
61 | 62 |
62 scoped_refptr<cc::AnimationPlayer> m_animationPlayer; | 63 scoped_refptr<cc::AnimationPlayer> m_animationPlayer; |
63 CompositorAnimationDelegate* m_delegate; | 64 CompositorAnimationDelegate* m_delegate; |
64 }; | 65 }; |
65 | 66 |
66 } // namespace blink | 67 } // namespace blink |
67 | 68 |
68 #endif // CompositorAnimationPlayer_h | 69 #endif // CompositorAnimationPlayer_h |
OLD | NEW |