Chromium Code Reviews| OLD | NEW |
|---|---|
| (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 { | |
|
ajuma
2015/04/22 15:47:18
It'd be helpful to have high-level comments somewh
loyso (OOO)
2015/04/30 06:40:21
Done.
loyso (OOO)
2015/05/01 04:02:54
Moreover, I'm going to update the design document
| |
| 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 RegisterLayer(int layer_id, bool is_active_tree); | |
| 37 void UnregisterLayer(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 AnimationPlayer* GetPlayerForLayerId(int layer_id) const; | |
| 42 | |
| 43 LayerTreeMutatorsClient* layer_tree_mutators_client() { | |
| 44 return layer_tree_mutators_client_; | |
| 45 } | |
| 46 const LayerTreeMutatorsClient* layer_tree_mutators_client() const { | |
| 47 return layer_tree_mutators_client_; | |
| 48 } | |
| 49 void SetLayerTreeMutatorsClient(LayerTreeMutatorsClient* client); | |
| 50 | |
| 51 void SetNeedsCommit(); | |
| 52 | |
| 53 void PushPropertiesTo(AnimationHost* host_impl); | |
| 54 | |
| 55 AnimationRegistrar* animation_registrar() const { | |
| 56 return animation_registrar_.get(); | |
| 57 } | |
| 58 | |
| 59 private: | |
| 60 // TODO(loyso): Temporary 1:1 mapping. AnimationPlayers share | |
| 61 // LayerAnimationController for a given layer at the moment. | |
| 62 // Introduce LayersAnimations for the many AnimationPlayers to many Layers | |
| 63 // mapping (a CC counterpart for blink::ElementAnimations). | |
| 64 typedef base::hash_map<int, AnimationPlayer*> LayerToPlayerMap; | |
| 65 LayerToPlayerMap layer_to_player_map_; | |
| 66 | |
| 67 explicit AnimationHost(bool is_impl_instance); | |
| 68 | |
| 69 void PushTimelinesToImplThread(AnimationHost* host_impl) const; | |
| 70 void RemoveTimelinesFromImplThread(AnimationHost* host_impl) const; | |
| 71 void PushPropertiesToImplThread(AnimationHost* host_impl); | |
| 72 | |
| 73 void EraseTimelines(AnimationTimelineList::iterator begin, | |
| 74 AnimationTimelineList::iterator end); | |
| 75 | |
| 76 AnimationTimelineList timelines_; | |
| 77 scoped_ptr<AnimationRegistrar> animation_registrar_; | |
| 78 LayerTreeMutatorsClient* layer_tree_mutators_client_; | |
| 79 | |
| 80 const bool is_impl_instance_; | |
| 81 | |
| 82 DISALLOW_COPY_AND_ASSIGN(AnimationHost); | |
| 83 }; | |
| 84 | |
| 85 } // namespace cc | |
| 86 | |
| 87 #endif // CC_ANIMATION_ANIMATION_HOST_H_ | |
| OLD | NEW |