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

Side by Side Diff: cc/animation/animation_host.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/BUILD.gn ('k') | cc/animation/animation_host.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_HOST_H_
6 #define CC_ANIMATION_ANIMATION_HOST_H_
7
8 #include <vector>
9
10 #include "base/containers/hash_tables.h"
11 #include "base/memory/ref_counted.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "cc/base/cc_export.h"
14
15 namespace cc {
16
17 class AnimationPlayer;
18 class AnimationRegistrar;
19 class AnimationTimeline;
20 class LayerTreeHost;
21 class LayerTreeMutatorsClient;
22
23 typedef std::vector<scoped_refptr<AnimationTimeline>> AnimationTimelineList;
24
25 class CC_EXPORT AnimationHost {
26 public:
27 static scoped_ptr<AnimationHost> Create(bool is_impl_instance);
28 virtual ~AnimationHost();
29
30 void AddAnimationTimeline(AnimationTimeline* timeline);
31 void RemoveAnimationTimeline(AnimationTimeline* timeline);
32 AnimationTimeline* GetTimelineById(int timeline_id) const;
33
34 void ClearTimelines();
35
36 void RegisterLayerImpl(int layer_id, bool is_active_tree);
37 void UnregisterLayerImpl(int layer_id, bool is_active_tree);
38
39 void RegisterPlayerForLayer(int layer_id, AnimationPlayer* player);
40 void UnregisterPlayerForLayer(int layer_id, AnimationPlayer* player);
41
42 LayerTreeMutatorsClient* layer_tree_mutators_client() {
43 return layer_tree_mutators_client_;
44 }
45 const LayerTreeMutatorsClient* layer_tree_mutators_client() const {
46 return layer_tree_mutators_client_;
47 }
48 void SetLayerTreeMutatorsClient(LayerTreeMutatorsClient* client);
49
50 void SetNeedsCommit();
51
52 void PushPropertiesTo(AnimationHost* host_impl);
53
54 AnimationRegistrar* animation_registrar() const {
55 return animation_registrar_.get();
56 }
57
58 private:
59 // TODO(loyso): Temporary 1:1 mapping. AnimationPlayers share
60 // LayerAnimationController for a given layer at the moment.
61 // Introduce LayersAnimations for the many AnimationPlayers to many Layers
62 // mapping (a CC counterpart for blink::ElementAnimations).
63 typedef base::hash_map<int, AnimationPlayer*> LayerToPlayerMap;
64 LayerToPlayerMap layer_to_player_map_;
65
66 explicit AnimationHost(bool is_impl_instance);
67
68 void PushTimelinesToImplThread(AnimationHost* host_impl) const;
69 void RemoveTimelinesFromImplThread(AnimationHost* host_impl) const;
70 void PushPropertiesToImplThread(AnimationHost* host_impl);
71
72 void EraseTimelines(AnimationTimelineList::iterator begin,
73 AnimationTimelineList::iterator end);
74
75 AnimationPlayer* GetPlayerForLayerId(int layer_id) const;
76
77 AnimationTimelineList timelines_;
78 scoped_ptr<AnimationRegistrar> animation_registrar_;
79 LayerTreeMutatorsClient* layer_tree_mutators_client_;
80
81 const bool is_impl_instance_;
82
83 DISALLOW_COPY_AND_ASSIGN(AnimationHost);
84 };
85
86 } // namespace cc
87
88 #endif // CC_ANIMATION_ANIMATION_HOST_H_
OLDNEW
« no previous file with comments | « cc/BUILD.gn ('k') | cc/animation/animation_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698