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

Side by Side Diff: cc/active_animation.h

Issue 11189043: cc: Rename cc classes and members to match filenames (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/threading/thread_restrictions.h ('k') | cc/active_animation.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CCActiveAnimation_h 5 #ifndef CCActiveAnimation_h
6 #define CCActiveAnimation_h 6 #define CCActiveAnimation_h
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 10
11 namespace cc { 11 namespace cc {
12 12
13 class CCAnimationCurve; 13 class AnimationCurve;
14 14
15 // A CCActiveAnimation, contains all the state required to play a CCAnimationCur ve. 15 // A ActiveAnimation, contains all the state required to play a AnimationCurve.
enne (OOO) 2012/10/18 01:28:32 Surprisingly, this seems like the only grammar iss
16 // Specifically, the affected property, the run state (paused, finished, etc.), 16 // Specifically, the affected property, the run state (paused, finished, etc.),
17 // loop count, last pause time, and the total time spent paused. 17 // loop count, last pause time, and the total time spent paused.
18 class CCActiveAnimation { 18 class ActiveAnimation {
19 public: 19 public:
20 // Animations begin in one of the 'waiting' states. Animations waiting for t he next tick 20 // Animations begin in one of the 'waiting' states. Animations waiting for t he next tick
21 // will start the next time the controller animates. Animations waiting for target 21 // will start the next time the controller animates. Animations waiting for target
22 // availibility will run as soon as their target property is free (and all t he animations 22 // availibility will run as soon as their target property is free (and all t he animations
23 // animating with it are also able to run). Animations waiting for their sta rt time to 23 // animating with it are also able to run). Animations waiting for their sta rt time to
24 // come have be scheduled to run at a particular point in time. When this ti me arrives, 24 // come have be scheduled to run at a particular point in time. When this ti me arrives,
25 // the controller will move the animations into the Running state. Running a nimations 25 // the controller will move the animations into the Running state. Running a nimations
26 // may toggle between Running and Paused, and may be stopped by moving into either the 26 // may toggle between Running and Paused, and may be stopped by moving into either the
27 // Aborted or Finished states. A Finished animation was allowed to run to co mpletion, but 27 // Aborted or Finished states. A Finished animation was allowed to run to co mpletion, but
28 // an Aborted animation was not. 28 // an Aborted animation was not.
(...skipping 10 matching lines...) Expand all
39 RunStateEnumSize 39 RunStateEnumSize
40 }; 40 };
41 41
42 enum TargetProperty { 42 enum TargetProperty {
43 Transform = 0, 43 Transform = 0,
44 Opacity, 44 Opacity,
45 // This sentinel must be last. 45 // This sentinel must be last.
46 TargetPropertyEnumSize 46 TargetPropertyEnumSize
47 }; 47 };
48 48
49 static scoped_ptr<CCActiveAnimation> create(scoped_ptr<CCAnimationCurve>, in t animationId, int groupId, TargetProperty); 49 static scoped_ptr<ActiveAnimation> create(scoped_ptr<AnimationCurve>, int an imationId, int groupId, TargetProperty);
50 50
51 virtual ~CCActiveAnimation(); 51 virtual ~ActiveAnimation();
52 52
53 int id() const { return m_id; } 53 int id() const { return m_id; }
54 int group() const { return m_group; } 54 int group() const { return m_group; }
55 TargetProperty targetProperty() const { return m_targetProperty; } 55 TargetProperty targetProperty() const { return m_targetProperty; }
56 56
57 RunState runState() const { return m_runState; } 57 RunState runState() const { return m_runState; }
58 void setRunState(RunState, double monotonicTime); 58 void setRunState(RunState, double monotonicTime);
59 59
60 // This is the number of times that the animation will play. If this 60 // This is the number of times that the animation will play. If this
61 // value is zero the animation will not play. If it is negative, then 61 // value is zero the animation will not play. If it is negative, then
(...skipping 13 matching lines...) Expand all
75 75
76 // If alternatesDirection is true, on odd numbered iterations we reverse the curve. 76 // If alternatesDirection is true, on odd numbered iterations we reverse the curve.
77 bool alternatesDirection() const { return m_alternatesDirection; } 77 bool alternatesDirection() const { return m_alternatesDirection; }
78 void setAlternatesDirection(bool alternates) { m_alternatesDirection = alter nates; } 78 void setAlternatesDirection(bool alternates) { m_alternatesDirection = alter nates; }
79 79
80 bool isFinishedAt(double monotonicTime) const; 80 bool isFinishedAt(double monotonicTime) const;
81 bool isFinished() const { return m_runState == Finished 81 bool isFinished() const { return m_runState == Finished
82 || m_runState == Aborted 82 || m_runState == Aborted
83 || m_runState == WaitingForDeletion; } 83 || m_runState == WaitingForDeletion; }
84 84
85 CCAnimationCurve* curve() { return m_curve.get(); } 85 AnimationCurve* curve() { return m_curve.get(); }
86 const CCAnimationCurve* curve() const { return m_curve.get(); } 86 const AnimationCurve* curve() const { return m_curve.get(); }
87 87
88 // If this is true, even if the animation is running, it will not be tickabl e until 88 // If this is true, even if the animation is running, it will not be tickabl e until
89 // it is given a start time. This is true for animations running on the main thread. 89 // it is given a start time. This is true for animations running on the main thread.
90 bool needsSynchronizedStartTime() const { return m_needsSynchronizedStartTim e; } 90 bool needsSynchronizedStartTime() const { return m_needsSynchronizedStartTim e; }
91 void setNeedsSynchronizedStartTime(bool needsSynchronizedStartTime) { m_need sSynchronizedStartTime = needsSynchronizedStartTime; } 91 void setNeedsSynchronizedStartTime(bool needsSynchronizedStartTime) { m_need sSynchronizedStartTime = needsSynchronizedStartTime; }
92 92
93 // Takes the given absolute time, and using the start time and the number 93 // Takes the given absolute time, and using the start time and the number
94 // of iterations, returns the relative time in the current iteration. 94 // of iterations, returns the relative time in the current iteration.
95 double trimTimeToCurrentIteration(double monotonicTime) const; 95 double trimTimeToCurrentIteration(double monotonicTime) const;
96 96
97 enum InstanceType { 97 enum InstanceType {
98 ControllingInstance = 0, 98 ControllingInstance = 0,
99 NonControllingInstance 99 NonControllingInstance
100 }; 100 };
101 101
102 scoped_ptr<CCActiveAnimation> clone(InstanceType) const; 102 scoped_ptr<ActiveAnimation> clone(InstanceType) const;
103 scoped_ptr<CCActiveAnimation> cloneAndInitialize(InstanceType, RunState init ialRunState, double startTime) const; 103 scoped_ptr<ActiveAnimation> cloneAndInitialize(InstanceType, RunState initia lRunState, double startTime) const;
104 bool isControllingInstance() const { return m_isControllingInstance; } 104 bool isControllingInstance() const { return m_isControllingInstance; }
105 105
106 void pushPropertiesTo(CCActiveAnimation*) const; 106 void pushPropertiesTo(ActiveAnimation*) const;
107 107
108 private: 108 private:
109 CCActiveAnimation(scoped_ptr<CCAnimationCurve>, int animationId, int groupId , TargetProperty); 109 ActiveAnimation(scoped_ptr<AnimationCurve>, int animationId, int groupId, Ta rgetProperty);
110 110
111 scoped_ptr<CCAnimationCurve> m_curve; 111 scoped_ptr<AnimationCurve> m_curve;
112 112
113 // IDs are not necessarily unique. 113 // IDs are not necessarily unique.
114 int m_id; 114 int m_id;
115 115
116 // Animations that must be run together are called 'grouped' and have the sa me group id 116 // Animations that must be run together are called 'grouped' and have the sa me group id
117 // Grouped animations are guaranteed to start at the same time and no other animations 117 // Grouped animations are guaranteed to start at the same time and no other animations
118 // may animate any of the group's target properties until all animations in the 118 // may animate any of the group's target properties until all animations in the
119 // group have finished animating. Note: an active animation's group id and t arget 119 // group have finished animating. Note: an active animation's group id and t arget
120 // property uniquely identify that animation. 120 // property uniquely identify that animation.
121 int m_group; 121 int m_group;
(...skipping 17 matching lines...) Expand all
139 139
140 // These are used in trimTimeToCurrentIteration to account for time 140 // These are used in trimTimeToCurrentIteration to account for time
141 // spent while paused. This is not included in AnimationState since it 141 // spent while paused. This is not included in AnimationState since it
142 // there is absolutely no need for clients of this controller to know 142 // there is absolutely no need for clients of this controller to know
143 // about these values. 143 // about these values.
144 double m_pauseTime; 144 double m_pauseTime;
145 double m_totalPausedTime; 145 double m_totalPausedTime;
146 146
147 // Animations lead dual lives. An active animation will be conceptually owne d by 147 // Animations lead dual lives. An active animation will be conceptually owne d by
148 // two controllers, one on the impl thread and one on the main. In reality, there 148 // two controllers, one on the impl thread and one on the main. In reality, there
149 // will be two separate CCActiveAnimation instances for the same animation. They 149 // will be two separate ActiveAnimation instances for the same animation. Th ey
150 // will have the same group id and the same target property (these two value s 150 // will have the same group id and the same target property (these two value s
151 // uniquely identify an animation). The instance on the impl thread is the i nstance 151 // uniquely identify an animation). The instance on the impl thread is the i nstance
152 // that ultimately controls the values of the animating layer and so we will refer 152 // that ultimately controls the values of the animating layer and so we will refer
153 // to it as the 'controlling instance'. 153 // to it as the 'controlling instance'.
154 bool m_isControllingInstance; 154 bool m_isControllingInstance;
155 155
156 DISALLOW_COPY_AND_ASSIGN(CCActiveAnimation); 156 DISALLOW_COPY_AND_ASSIGN(ActiveAnimation);
157 }; 157 };
158 158
159 } // namespace cc 159 } // namespace cc
160 160
161 #endif // CCActiveAnimation_h 161 #endif // CCActiveAnimation_h
OLDNEW
« no previous file with comments | « base/threading/thread_restrictions.h ('k') | cc/active_animation.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698