| 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..0779ba0a42c537b747da919bc09516d1b38cc2b5
|
| --- /dev/null
|
| +++ b/cc/animation/animation_host.h
|
| @@ -0,0 +1,88 @@
|
| +// 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 {
|
| + 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 RegisterLayerImpl(int layer_id, bool is_active_tree);
|
| + void UnregisterLayerImpl(int layer_id, bool is_active_tree);
|
| +
|
| + void RegisterPlayerForLayer(int layer_id, AnimationPlayer* player);
|
| + void UnregisterPlayerForLayer(int layer_id, AnimationPlayer* player);
|
| +
|
| + 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);
|
| +
|
| + AnimationPlayer* GetPlayerForLayerId(int layer_id) const;
|
| +
|
| + 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_
|
|
|