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

Side by Side Diff: cc/animation/animation_player.h

Issue 947033002: CC Animations: Establish AnimationHost, AnimationTimeline and AnimationPlayer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Set up impl-only timelines for ScrollOffset animations Created 5 years, 8 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 unified diff | Download patch
« no previous file with comments | « cc/animation/animation_id_provider.cc ('k') | cc/animation/animation_player.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CC_ANIMATION_ANIMATION_PLAYER_H_
6 #define CC_ANIMATION_ANIMATION_PLAYER_H_
7
8 #include "base/memory/ref_counted.h"
9 #include "cc/animation/layer_animation_controller.h"
10 #include "cc/animation/layer_animation_value_observer.h"
11 #include "cc/animation/layer_animation_value_provider.h"
12 #include "cc/base/cc_export.h"
13
14 namespace gfx {
15 class ScrollOffset;
16 class Transform;
17 }
18
19 namespace cc {
20
21 class AnimationHost;
22 class AnimationTimeline;
23 class FilterOperations;
24 class Layer;
25
26 class CC_EXPORT AnimationPlayer : public base::RefCounted<AnimationPlayer>,
27 public LayerAnimationValueProvider {
28 public:
29 static scoped_refptr<AnimationPlayer> Create(int id);
30 scoped_refptr<AnimationPlayer> CreateImplInstance() const;
31
32 int id() const { return id_; }
33 int layer_id() const { return layer_id_; }
34
35 AnimationHost* animation_host() { return animation_host_; }
36 const AnimationHost* animation_host() const { return animation_host_; }
37 void SetAnimationHost(AnimationHost* animation_host);
38
39 AnimationTimeline* animation_timeline() { return animation_timeline_; }
40 const AnimationTimeline* animation_timeline() const {
41 return animation_timeline_;
42 }
43 void SetAnimationTimeline(AnimationTimeline* timeline);
44
45 LayerAnimationController* layer_animation_controller() const {
46 return layer_animation_controller_.get();
47 }
48
49 void set_layer_animation_delegate(AnimationDelegate* delegate);
50
51 void AttachLayer(int layer_id);
52 void DetachLayer();
53
54 void LayerImplRegistered(int layer_id, bool is_active_tree);
55 void LayerImplUnregistered(int layer_id, bool is_active_tree);
56
57 void AddAnimation(scoped_ptr<Animation> animation);
58 void PauseAnimation(int animation_id, double time_offset);
59 void RemoveAnimation(int animation_id);
60
61 void PushPropertiesTo(AnimationPlayer* player_impl);
62
63 private:
64 friend class base::RefCounted<AnimationPlayer>;
65
66 explicit AnimationPlayer(int id);
67 ~AnimationPlayer() override;
68
69 void SetNeedsCommit();
70
71 void SetFilterMutated(bool active_tree, const FilterOperations& filters);
72 void SetOpacityMutated(bool active_tree, float opacity);
73 void SetTransformMutated(bool active_tree, const gfx::Transform& transform);
74 void SetScrollOffsetMutated(bool active_tree,
75 const gfx::ScrollOffset& scroll_offset);
76
77 void AddControllerToTimeline();
78 void RemoveControllerFromTimeline();
79
80 void CreateActiveValueObserver();
81 void DestroyActiveValueObserver();
82
83 void CreatePendingValueObserver();
84 void DestroyPendingValueObserver();
85
86 // LayerAnimationValueProvider implementation.
87 gfx::ScrollOffset ScrollOffsetForAnimation() const override;
88
89 class ValueObserver;
90 scoped_ptr<ValueObserver> active_value_observer_;
91 scoped_ptr<ValueObserver> pending_value_observer_;
92
93 scoped_refptr<LayerAnimationController> layer_animation_controller_;
94 AnimationHost* animation_host_;
95 AnimationTimeline* animation_timeline_;
96 AnimationDelegate* layer_animation_delegate_;
97
98 int id_;
99 int layer_id_;
100
101 DISALLOW_COPY_AND_ASSIGN(AnimationPlayer);
102 };
103
104 } // namespace cc
105
106 #endif // CC_ANIMATION_ANIMATION_PLAYER_H_
OLDNEW
« no previous file with comments | « cc/animation/animation_id_provider.cc ('k') | cc/animation/animation_player.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698