Index: cc/animation/animation_host.h |
diff --git a/cc/animation/animation_host.h b/cc/animation/animation_host.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..47536c29eacaff78c6f65ff5005c0966af24f2c7 |
--- /dev/null |
+++ b/cc/animation/animation_host.h |
@@ -0,0 +1,87 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CC_ANIMATION_ANIMATION_HOST_H_ |
+#define CC_ANIMATION_ANIMATION_HOST_H_ |
+ |
+#include <vector> |
+ |
+#include "base/containers/hash_tables.h" |
+#include "base/memory/ref_counted.h" |
+#include "base/memory/scoped_ptr.h" |
+#include "cc/base/cc_export.h" |
+ |
+namespace cc { |
+ |
+class AnimationPlayer; |
+class AnimationRegistrar; |
+class AnimationTimeline; |
+class LayerTreeHost; |
+class LayerTreeMutatorsClient; |
+ |
+typedef std::vector<scoped_refptr<AnimationTimeline>> AnimationTimelineList; |
+ |
+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
|
+ public: |
+ static scoped_ptr<AnimationHost> Create(bool is_impl_instance); |
+ virtual ~AnimationHost(); |
+ |
+ void AddAnimationTimeline(AnimationTimeline* timeline); |
+ void RemoveAnimationTimeline(AnimationTimeline* timeline); |
+ AnimationTimeline* GetTimelineById(int timeline_id) const; |
+ |
+ void ClearTimelines(); |
+ |
+ void RegisterLayer(int layer_id, bool is_active_tree); |
+ void UnregisterLayer(int layer_id, bool is_active_tree); |
+ |
+ void RegisterPlayerForLayer(int layer_id, AnimationPlayer* player); |
+ void UnregisterPlayerForLayer(int layer_id, AnimationPlayer* player); |
+ AnimationPlayer* GetPlayerForLayerId(int layer_id) const; |
+ |
+ LayerTreeMutatorsClient* layer_tree_mutators_client() { |
+ return layer_tree_mutators_client_; |
+ } |
+ const LayerTreeMutatorsClient* layer_tree_mutators_client() const { |
+ return layer_tree_mutators_client_; |
+ } |
+ void SetLayerTreeMutatorsClient(LayerTreeMutatorsClient* client); |
+ |
+ void SetNeedsCommit(); |
+ |
+ void PushPropertiesTo(AnimationHost* host_impl); |
+ |
+ AnimationRegistrar* animation_registrar() const { |
+ return animation_registrar_.get(); |
+ } |
+ |
+ private: |
+ // TODO(loyso): Temporary 1:1 mapping. AnimationPlayers share |
+ // LayerAnimationController for a given layer at the moment. |
+ // Introduce LayersAnimations for the many AnimationPlayers to many Layers |
+ // mapping (a CC counterpart for blink::ElementAnimations). |
+ typedef base::hash_map<int, AnimationPlayer*> LayerToPlayerMap; |
+ LayerToPlayerMap layer_to_player_map_; |
+ |
+ explicit AnimationHost(bool is_impl_instance); |
+ |
+ void PushTimelinesToImplThread(AnimationHost* host_impl) const; |
+ void RemoveTimelinesFromImplThread(AnimationHost* host_impl) const; |
+ void PushPropertiesToImplThread(AnimationHost* host_impl); |
+ |
+ void EraseTimelines(AnimationTimelineList::iterator begin, |
+ AnimationTimelineList::iterator end); |
+ |
+ AnimationTimelineList timelines_; |
+ scoped_ptr<AnimationRegistrar> animation_registrar_; |
+ LayerTreeMutatorsClient* layer_tree_mutators_client_; |
+ |
+ const bool is_impl_instance_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(AnimationHost); |
+}; |
+ |
+} // namespace cc |
+ |
+#endif // CC_ANIMATION_ANIMATION_HOST_H_ |