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