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_TIMELINE_H_ |
| 6 #define CC_ANIMATION_ANIMATION_TIMELINE_H_ |
| 7 |
| 8 #include <vector> |
| 9 |
| 10 #include "base/containers/hash_tables.h" |
| 11 #include "base/memory/ref_counted.h" |
| 12 #include "cc/base/cc_export.h" |
| 13 |
| 14 namespace cc { |
| 15 |
| 16 class AnimationPlayer; |
| 17 class LayerTreeHost; |
| 18 class LayerTreeMutatorsClient; |
| 19 |
| 20 typedef std::vector<scoped_refptr<AnimationPlayer>> AnimationPlayerList; |
| 21 |
| 22 class CC_EXPORT AnimationTimeline : public base::RefCounted<AnimationTimeline> { |
| 23 public: |
| 24 static scoped_refptr<AnimationTimeline> Create(); |
| 25 |
| 26 void AttachPlayer(AnimationPlayer* player); |
| 27 void DetachPlayer(AnimationPlayer* player); |
| 28 AnimationPlayer* GetPlayerById(int player_id) const; |
| 29 |
| 30 void RegisterLayerImpl(int layer_id, bool is_active_tree); |
| 31 void UnregisterLayerImpl(int layer_id, bool is_active_tree); |
| 32 |
| 33 void RegisterPlayerForLayer(int layer_id, AnimationPlayer* player); |
| 34 void UnregisterPlayerForLayer(int layer_id, AnimationPlayer* player); |
| 35 |
| 36 LayerTreeMutatorsClient* layer_tree_mutators_client() { |
| 37 return layer_tree_mutators_client_; |
| 38 } |
| 39 const LayerTreeMutatorsClient* layer_tree_mutators_client() const { |
| 40 return layer_tree_mutators_client_; |
| 41 } |
| 42 void SetLayerTreeMutatorsClient(LayerTreeMutatorsClient* client); |
| 43 |
| 44 void PushPropertiesTo(AnimationTimeline* timeline_impl); |
| 45 |
| 46 private: |
| 47 friend class base::RefCounted<AnimationTimeline>; |
| 48 |
| 49 typedef base::hash_map<int, AnimationPlayer*> LayerToPlayerMap; |
| 50 LayerToPlayerMap layer_to_player_map_; |
| 51 |
| 52 AnimationTimeline(); |
| 53 virtual ~AnimationTimeline(); |
| 54 |
| 55 void PushAttachedPlayersToImplThread(AnimationTimeline* timeline) const; |
| 56 void RemoveDetachedPlayersFromImplThread(AnimationTimeline* timeline) const; |
| 57 void PushPropertiesToImplThread(AnimationTimeline* timeline); |
| 58 |
| 59 AnimationPlayer* GetPlayerForLayerId(int layer_id) const; |
| 60 |
| 61 AnimationPlayerList players_; |
| 62 LayerTreeMutatorsClient* layer_tree_mutators_client_; |
| 63 |
| 64 DISALLOW_COPY_AND_ASSIGN(AnimationTimeline); |
| 65 }; |
| 66 |
| 67 } // namespace cc |
| 68 |
| 69 #endif // CC_ANIMATION_ANIMATION_TIMELINE_H_ |
OLD | NEW |