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

Side by Side Diff: Source/core/animation/AnimationEffect.h

Issue 1120003002: [Oilpan] Migrate most classes under core/animations to Oilpan heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Resize expect size of Persistent Created 5 years, 6 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 static inline bool isNull(double value) 54 static inline bool isNull(double value)
55 { 55 {
56 return std::isnan(value); 56 return std::isnan(value);
57 } 57 }
58 58
59 static inline double nullValue() 59 static inline double nullValue()
60 { 60 {
61 return std::numeric_limits<double>::quiet_NaN(); 61 return std::numeric_limits<double>::quiet_NaN();
62 } 62 }
63 63
64 class CORE_EXPORT AnimationEffect : public RefCountedWillBeGarbageCollectedFinal ized<AnimationEffect>, public ScriptWrappable { 64 class CORE_EXPORT AnimationEffect : public GarbageCollectedFinalized<AnimationEf fect>, public ScriptWrappable {
65 DEFINE_WRAPPERTYPEINFO(); 65 DEFINE_WRAPPERTYPEINFO();
66 friend class Animation; // Calls attach/detach, updateInheritedTime. 66 friend class Animation; // Calls attach/detach, updateInheritedTime.
67 public: 67 public:
68 // Note that logic in CSSAnimations depends on the order of these values. 68 // Note that logic in CSSAnimations depends on the order of these values.
69 enum Phase { 69 enum Phase {
70 PhaseBefore, 70 PhaseBefore,
71 PhaseActive, 71 PhaseActive,
72 PhaseAfter, 72 PhaseAfter,
73 PhaseNone, 73 PhaseNone,
74 }; 74 };
75 75
76 class EventDelegate : public NoBaseWillBeGarbageCollectedFinalized<EventDele gate> { 76 class EventDelegate : public GarbageCollectedFinalized<EventDelegate> {
77 public: 77 public:
78 virtual ~EventDelegate() { } 78 virtual ~EventDelegate() { }
79 virtual bool requiresIterationEvents(const AnimationEffect&) = 0; 79 virtual bool requiresIterationEvents(const AnimationEffect&) = 0;
80 virtual void onEventCondition(const AnimationEffect&) = 0; 80 virtual void onEventCondition(const AnimationEffect&) = 0;
81 DEFINE_INLINE_VIRTUAL_TRACE() { } 81 DEFINE_INLINE_VIRTUAL_TRACE() { }
82 }; 82 };
83 83
84 virtual ~AnimationEffect() { } 84 virtual ~AnimationEffect() { }
85 85
86 virtual bool isAnimation() const { return false; } 86 virtual bool isAnimation() const { return false; }
87 87
88 Phase phase() const { return ensureCalculated().phase; } 88 Phase phase() const { return ensureCalculated().phase; }
89 bool isCurrent() const { return ensureCalculated().isCurrent; } 89 bool isCurrent() const { return ensureCalculated().isCurrent; }
90 bool isInEffect() const { return ensureCalculated().isInEffect; } 90 bool isInEffect() const { return ensureCalculated().isInEffect; }
91 bool isInPlay() const { return ensureCalculated().isInPlay; } 91 bool isInPlay() const { return ensureCalculated().isInPlay; }
92 double currentIteration() const { return ensureCalculated().currentIteration ; } 92 double currentIteration() const { return ensureCalculated().currentIteration ; }
93 double timeFraction() const { return ensureCalculated().timeFraction; } 93 double timeFraction() const { return ensureCalculated().timeFraction; }
94 double timeToForwardsEffectChange() const { return ensureCalculated().timeTo ForwardsEffectChange; } 94 double timeToForwardsEffectChange() const { return ensureCalculated().timeTo ForwardsEffectChange; }
95 double timeToReverseEffectChange() const { return ensureCalculated().timeToR everseEffectChange; } 95 double timeToReverseEffectChange() const { return ensureCalculated().timeToR everseEffectChange; }
96 96
97 double iterationDuration() const; 97 double iterationDuration() const;
98 double activeDurationInternal() const; 98 double activeDurationInternal() const;
99 double startTimeInternal() const { return m_startTime; } 99 double startTimeInternal() const { return m_startTime; }
100 double endTimeInternal() const { return std::max(startTimeInternal(), startT imeInternal() + specifiedTiming().startDelay + activeDurationInternal() + specif iedTiming().endDelay); } 100 double endTimeInternal() const { return std::max(startTimeInternal(), startT imeInternal() + specifiedTiming().startDelay + activeDurationInternal() + specif iedTiming().endDelay); }
101 101
102 const Animation* animation() const { return m_animation; } 102 const Animation* animation() const { return m_animation; }
103 Animation* animation() { return m_animation; } 103 Animation* animation() { return m_animation; }
104 const Timing& specifiedTiming() const { return m_timing; } 104 const Timing& specifiedTiming() const { return m_timing; }
105 PassRefPtrWillBeRawPtr<AnimationEffectTiming> timing(); 105 AnimationEffectTiming* timing();
106 void updateSpecifiedTiming(const Timing&); 106 void updateSpecifiedTiming(const Timing&);
107 107
108 void computedTiming(ComputedTimingProperties&); 108 void computedTiming(ComputedTimingProperties&);
109 ComputedTimingProperties computedTiming(); 109 ComputedTimingProperties computedTiming();
110 110
111 void setName(const String& name) { m_name = name; } 111 void setName(const String& name) { m_name = name; }
112 const String& name() const { return m_name; } 112 const String& name() const { return m_name; }
113 113
114 DECLARE_VIRTUAL_TRACE(); 114 DECLARE_VIRTUAL_TRACE();
115 115
116 protected: 116 protected:
117 explicit AnimationEffect(const Timing&, PassOwnPtrWillBeRawPtr<EventDelegate > = nullptr); 117 explicit AnimationEffect(const Timing&, EventDelegate* = nullptr);
118 118
119 // When AnimationEffect receives a new inherited time via updateInheritedTim e 119 // When AnimationEffect receives a new inherited time via updateInheritedTim e
120 // it will (if necessary) recalculate timings and (if necessary) call 120 // it will (if necessary) recalculate timings and (if necessary) call
121 // updateChildrenAndEffects. 121 // updateChildrenAndEffects.
122 void updateInheritedTime(double inheritedTime, TimingUpdateReason) const; 122 void updateInheritedTime(double inheritedTime, TimingUpdateReason) const;
123 void invalidate() const { m_needsUpdate = true; }; 123 void invalidate() const { m_needsUpdate = true; };
124 bool requiresIterationEvents() const { return m_eventDelegate && m_eventDele gate->requiresIterationEvents(*this); } 124 bool requiresIterationEvents() const { return m_eventDelegate && m_eventDele gate->requiresIterationEvents(*this); }
125 void clearEventDelegate() { m_eventDelegate = nullptr; } 125 void clearEventDelegate() { m_eventDelegate = nullptr; }
126 126
127 virtual void attach(Animation* animation) 127 virtual void attach(Animation* animation)
128 { 128 {
129 m_animation = animation; 129 m_animation = animation;
130 } 130 }
131 131
132 virtual void detach() 132 virtual void detach()
133 { 133 {
134 ASSERT(m_animation); 134 ASSERT(m_animation);
135 m_animation = nullptr; 135 m_animation = nullptr;
136 } 136 }
137 137
138 double repeatedDuration() const; 138 double repeatedDuration() const;
139 139
140 virtual void updateChildrenAndEffects() const = 0; 140 virtual void updateChildrenAndEffects() const = 0;
141 virtual double intrinsicIterationDuration() const { return 0; }; 141 virtual double intrinsicIterationDuration() const { return 0; };
142 virtual double calculateTimeToEffectChange(bool forwards, double localTime, double timeToNextIteration) const = 0; 142 virtual double calculateTimeToEffectChange(bool forwards, double localTime, double timeToNextIteration) const = 0;
143 virtual void specifiedTimingChanged() { } 143 virtual void specifiedTimingChanged() { }
144 144
145 // FIXME: m_parent and m_startTime are placeholders, they depend on timing g roups. 145 // FIXME: m_parent and m_startTime are placeholders, they depend on timing g roups.
146 RawPtrWillBeMember<AnimationEffect> m_parent; 146 Member<AnimationEffect> m_parent;
147 const double m_startTime; 147 const double m_startTime;
148 RawPtrWillBeMember<Animation> m_animation; 148 Member<Animation> m_animation;
149 Timing m_timing; 149 Timing m_timing;
150 OwnPtrWillBeMember<EventDelegate> m_eventDelegate; 150 Member<EventDelegate> m_eventDelegate;
151 151
152 mutable struct CalculatedTiming { 152 mutable struct CalculatedTiming {
153 Phase phase; 153 Phase phase;
154 double currentIteration; 154 double currentIteration;
155 double timeFraction; 155 double timeFraction;
156 bool isCurrent; 156 bool isCurrent;
157 bool isInEffect; 157 bool isInEffect;
158 bool isInPlay; 158 bool isInPlay;
159 double localTime; 159 double localTime;
160 double timeToForwardsEffectChange; 160 double timeToForwardsEffectChange;
161 double timeToReverseEffectChange; 161 double timeToReverseEffectChange;
162 } m_calculated; 162 } m_calculated;
163 mutable bool m_needsUpdate; 163 mutable bool m_needsUpdate;
164 mutable double m_lastUpdateTime; 164 mutable double m_lastUpdateTime;
165 String m_name; 165 String m_name;
166 166
167 const CalculatedTiming& ensureCalculated() const; 167 const CalculatedTiming& ensureCalculated() const;
168 }; 168 };
169 169
170 } // namespace blink 170 } // namespace blink
171 171
172 #endif // AnimationEffect_h 172 #endif // AnimationEffect_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698