Chromium Code Reviews| Index: cc/animation/animation_player.h |
| diff --git a/cc/animation/animation_player.h b/cc/animation/animation_player.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..b5d92f2e46ff2dee6f1f7827e4f9b7022c261290 |
| --- /dev/null |
| +++ b/cc/animation/animation_player.h |
| @@ -0,0 +1,109 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CC_ANIMATION_ANIMATION_PLAYER_H_ |
| +#define CC_ANIMATION_ANIMATION_PLAYER_H_ |
| + |
| +#include "base/memory/ref_counted.h" |
| +#include "cc/animation/layer_animation_controller.h" |
| +#include "cc/animation/layer_animation_value_observer.h" |
| +#include "cc/animation/layer_animation_value_provider.h" |
| +#include "cc/base/cc_export.h" |
| + |
| +namespace cc { |
| + |
| +class AnimationPlayerPendingValueObserver; |
| +class AnimationTimeline; |
| +class Layer; |
| + |
| +class CC_EXPORT AnimationPlayer : public base::RefCounted<AnimationPlayer>, |
| + public LayerAnimationValueObserver, |
| + public LayerAnimationValueProvider { |
| + public: |
| + static scoped_refptr<AnimationPlayer> Create(int id = 0); |
| + scoped_refptr<AnimationPlayer> CreateImplInstance() const; |
| + |
| + int id() const { return id_; } |
| + |
| + AnimationTimeline* animation_timeline() { return animation_timeline_; } |
| + const AnimationTimeline* animation_timeline() const { |
| + return animation_timeline_; |
| + } |
| + void SetAnimationTimeline(AnimationTimeline* timeline); |
| + |
| + LayerAnimationController* layer_animation_controller() const { |
| + return layer_animation_controller_.get(); |
| + } |
| + |
| + void set_layer_animation_delegate(AnimationDelegate* delegate); |
| + |
| + void AttachLayer(int layer_id); |
| + void DetachLayer(); |
| + |
| + void AddAnimation(scoped_ptr<Animation> animation); |
| + void PauseAnimation(int animation_id, double time_offset); |
| + void RemoveAnimation(int animation_id); |
| + |
| + void PushPropertiesTo(AnimationPlayer* player_impl); |
| + |
| + private: |
| + friend class base::RefCounted<AnimationPlayer>; |
| + friend class AnimationPlayerPendingValueObserver; |
| + |
| + explicit AnimationPlayer(int id); |
| + ~AnimationPlayer() override; |
| + |
| + void SetNeedsCommit(); |
| + |
| + void SetFilterMutated(bool active_tree, const FilterOperations& filters); |
| + void SetOpacityMutated(bool active_tree, float opacity); |
| + void SetTransformMutated(bool active_tree, const gfx::Transform& transform); |
| + |
| + // LayerAnimationValueProvider implementation. |
| + gfx::ScrollOffset ScrollOffsetForAnimation() const override; |
| + |
| + // LayerAnimationValueObserver implementation. |
| + void OnFilterAnimated(const FilterOperations& filters) override; |
| + void OnOpacityAnimated(float opacity) override; |
| + void OnTransformAnimated(const gfx::Transform& transform) override; |
| + void OnScrollOffsetAnimated(const gfx::ScrollOffset& scroll_offset) override; |
| + void OnAnimationWaitingForDeletion() override; |
| + bool IsActive() const override; |
| + |
| + // non-null only for impl thread instance. |
| + scoped_ptr<AnimationPlayerPendingValueObserver> pending_value_observer_; |
| + |
| + scoped_refptr<LayerAnimationController> layer_animation_controller_; |
| + AnimationTimeline* animation_timeline_; |
| + AnimationDelegate* layer_animation_delegate_; |
| + |
| + int id_; |
| + int layer_id_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(AnimationPlayer); |
| +}; |
| + |
| +class AnimationPlayerPendingValueObserver : public LayerAnimationValueObserver { |
|
ajuma
2015/02/23 16:36:44
Nit: This should go in a separate file.
loyso (OOO)
2015/02/25 04:37:03
We will eliminate LayerAnimationValueObserver and
ajuma
2015/02/25 14:57:25
If this is purely an implementation detail of Anim
|
| + public: |
| + // LayerAnimationValueObserver implementation. |
| + void OnFilterAnimated(const FilterOperations& filters) override; |
| + void OnOpacityAnimated(float opacity) override; |
| + void OnTransformAnimated(const gfx::Transform& transform) override; |
| + void OnScrollOffsetAnimated(const gfx::ScrollOffset& scroll_offset) override; |
| + void OnAnimationWaitingForDeletion() override; |
| + bool IsActive() const override; |
| + |
| + private: |
| + friend class AnimationPlayer; |
|
ajuma
2015/02/25 14:57:25
I missed this the first time through, but rather t
loyso (OOO)
2015/02/26 03:04:44
Do you mean nested class? Ok. I'm going to make it
|
| + |
| + explicit AnimationPlayerPendingValueObserver(AnimationPlayer* player); |
| + |
| + AnimationPlayer* player_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(AnimationPlayerPendingValueObserver); |
| +}; |
| + |
| +} // namespace cc |
| + |
| +#endif // CC_ANIMATION_ANIMATION_PLAYER_H_ |