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 "base/memory/scoped_ptr.h" |
| 13 #include "cc/base/cc_export.h" |
| 14 |
| 15 namespace cc { |
| 16 |
| 17 class AnimationHost; |
| 18 class AnimationPlayer; |
| 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(int id); |
| 25 scoped_refptr<AnimationTimeline> CreateImplInstance() const; |
| 26 |
| 27 int id() const { return id_; } |
| 28 |
| 29 AnimationHost* animation_host() { return animation_host_; } |
| 30 const AnimationHost* animation_host() const { return animation_host_; } |
| 31 void SetAnimationHost(AnimationHost* animation_host); |
| 32 |
| 33 void set_is_impl_only(bool is_impl_only) { is_impl_only_ = is_impl_only; } |
| 34 bool is_impl_only() const { return is_impl_only_; } |
| 35 |
| 36 void AttachPlayer(AnimationPlayer* player); |
| 37 void DetachPlayer(AnimationPlayer* player); |
| 38 |
| 39 void ClearPlayers(); |
| 40 |
| 41 void PushPropertiesTo(AnimationTimeline* timeline_impl); |
| 42 |
| 43 private: |
| 44 friend class base::RefCounted<AnimationTimeline>; |
| 45 |
| 46 explicit AnimationTimeline(int id); |
| 47 virtual ~AnimationTimeline(); |
| 48 |
| 49 AnimationPlayer* GetPlayerById(int player_id) const; |
| 50 |
| 51 void PushAttachedPlayersToImplThread(AnimationTimeline* timeline) const; |
| 52 void RemoveDetachedPlayersFromImplThread(AnimationTimeline* timeline) const; |
| 53 void PushPropertiesToImplThread(AnimationTimeline* timeline); |
| 54 |
| 55 void ErasePlayers(AnimationPlayerList::iterator begin, |
| 56 AnimationPlayerList::iterator end); |
| 57 |
| 58 AnimationPlayerList players_; |
| 59 int id_; |
| 60 AnimationHost* animation_host_; |
| 61 bool is_impl_only_; |
| 62 |
| 63 DISALLOW_COPY_AND_ASSIGN(AnimationTimeline); |
| 64 }; |
| 65 |
| 66 } // namespace cc |
| 67 |
| 68 #endif // CC_ANIMATION_ANIMATION_TIMELINE_H_ |
OLD | NEW |