Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3293)

Unified Diff: cc/animation/animation_timeline.h

Issue 947033002: CC Animations: Establish AnimationHost, AnimationTimeline and AnimationPlayer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Set up impl-only timelines for ScrollOffset animations Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/animation/animation_player.cc ('k') | cc/animation/animation_timeline.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/animation/animation_timeline.h
diff --git a/cc/animation/animation_timeline.h b/cc/animation/animation_timeline.h
new file mode 100644
index 0000000000000000000000000000000000000000..f78a56ef85886a323b3e253d3f009441c480622f
--- /dev/null
+++ b/cc/animation/animation_timeline.h
@@ -0,0 +1,68 @@
+// 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_TIMELINE_H_
+#define CC_ANIMATION_ANIMATION_TIMELINE_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 AnimationHost;
+class AnimationPlayer;
+
+typedef std::vector<scoped_refptr<AnimationPlayer>> AnimationPlayerList;
+
+class CC_EXPORT AnimationTimeline : public base::RefCounted<AnimationTimeline> {
+ public:
+ static scoped_refptr<AnimationTimeline> Create(int id);
+ scoped_refptr<AnimationTimeline> CreateImplInstance() const;
+
+ int id() const { return id_; }
+
+ AnimationHost* animation_host() { return animation_host_; }
+ const AnimationHost* animation_host() const { return animation_host_; }
+ void SetAnimationHost(AnimationHost* animation_host);
+
+ void set_is_impl_only(bool is_impl_only) { is_impl_only_ = is_impl_only; }
+ bool is_impl_only() const { return is_impl_only_; }
+
+ void AttachPlayer(AnimationPlayer* player);
+ void DetachPlayer(AnimationPlayer* player);
+
+ void ClearPlayers();
+
+ void PushPropertiesTo(AnimationTimeline* timeline_impl);
+
+ private:
+ friend class base::RefCounted<AnimationTimeline>;
+
+ explicit AnimationTimeline(int id);
+ virtual ~AnimationTimeline();
+
+ AnimationPlayer* GetPlayerById(int player_id) const;
+
+ void PushAttachedPlayersToImplThread(AnimationTimeline* timeline) const;
+ void RemoveDetachedPlayersFromImplThread(AnimationTimeline* timeline) const;
+ void PushPropertiesToImplThread(AnimationTimeline* timeline);
+
+ void ErasePlayers(AnimationPlayerList::iterator begin,
+ AnimationPlayerList::iterator end);
+
+ AnimationPlayerList players_;
+ int id_;
+ AnimationHost* animation_host_;
+ bool is_impl_only_;
+
+ DISALLOW_COPY_AND_ASSIGN(AnimationTimeline);
+};
+
+} // namespace cc
+
+#endif // CC_ANIMATION_ANIMATION_TIMELINE_H_
« no previous file with comments | « cc/animation/animation_player.cc ('k') | cc/animation/animation_timeline.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698