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

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

Issue 225073004: Oilpan: Completely move core/animations/ to oilpan's heap (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 7 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
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 22 matching lines...) Expand all
33 33
34 #include "core/animation/TimedItem.h" 34 #include "core/animation/TimedItem.h"
35 #include "core/events/EventTarget.h" 35 #include "core/events/EventTarget.h"
36 #include "wtf/RefPtr.h" 36 #include "wtf/RefPtr.h"
37 37
38 namespace WebCore { 38 namespace WebCore {
39 39
40 class DocumentTimeline; 40 class DocumentTimeline;
41 class ExceptionState; 41 class ExceptionState;
42 42
43 class AnimationPlayer FINAL : public RefCounted<AnimationPlayer>, public EventTa rgetWithInlineData { 43 class AnimationPlayer FINAL : public RefCountedWillBeRefCountedGarbageCollected< AnimationPlayer>, public EventTargetWithInlineData {
44 REFCOUNTED_EVENT_TARGET(AnimationPlayer); 44 DEFINE_EVENT_TARGET_REFCOUNTING(RefCountedWillBeRefCountedGarbageCollected<A nimationPlayer>);
45 public: 45 public:
46 enum UpdateReason { 46 enum UpdateReason {
47 UpdateOnDemand, 47 UpdateOnDemand,
48 UpdateForAnimationFrame 48 UpdateForAnimationFrame
49 }; 49 };
50 50
51 ~AnimationPlayer(); 51 ~AnimationPlayer();
52 static PassRefPtr<AnimationPlayer> create(DocumentTimeline&, TimedItem*); 52 static PassRefPtrWillBeRawPtr<AnimationPlayer> create(DocumentTimeline&, Tim edItem*);
53 53
54 // Returns whether the player is finished. 54 // Returns whether the player is finished.
55 bool update(UpdateReason); 55 bool update(UpdateReason);
56 56
57 // timeToEffectChange returns: 57 // timeToEffectChange returns:
58 // infinity - if this player is no longer in effect 58 // infinity - if this player is no longer in effect
59 // 0 - if this player requires an update on the next frame 59 // 0 - if this player requires an update on the next frame
60 // n - if this player requires an update after 'n' units of time 60 // n - if this player requires an update after 'n' units of time
61 double timeToEffectChange(); 61 double timeToEffectChange();
62 62
(...skipping 15 matching lines...) Expand all
78 DEFINE_ATTRIBUTE_EVENT_LISTENER(finish); 78 DEFINE_ATTRIBUTE_EVENT_LISTENER(finish);
79 79
80 virtual const AtomicString& interfaceName() const OVERRIDE; 80 virtual const AtomicString& interfaceName() const OVERRIDE;
81 virtual ExecutionContext* executionContext() const OVERRIDE; 81 virtual ExecutionContext* executionContext() const OVERRIDE;
82 82
83 double playbackRate() const { return m_playbackRate; } 83 double playbackRate() const { return m_playbackRate; }
84 void setPlaybackRate(double); 84 void setPlaybackRate(double);
85 const DocumentTimeline* timeline() const { return m_timeline; } 85 const DocumentTimeline* timeline() const { return m_timeline; }
86 DocumentTimeline* timeline() { return m_timeline; } 86 DocumentTimeline* timeline() { return m_timeline; }
87 87
88 void timelineDestroyed() { m_timeline = 0; } 88 #if !ENABLE(OILPAN)
89 void timelineDestroyed() { m_timeline = nullptr; }
90 #endif
89 91
90 bool hasStartTime() const { return !isNull(m_startTime); } 92 bool hasStartTime() const { return !isNull(m_startTime); }
91 double startTime() const { return m_startTime * 1000; } 93 double startTime() const { return m_startTime * 1000; }
92 double startTimeInternal() const { return m_startTime; } 94 double startTimeInternal() const { return m_startTime; }
93 void setStartTime(double startTime) { setStartTimeInternal(startTime / 1000) ; } 95 void setStartTime(double startTime) { setStartTimeInternal(startTime / 1000) ; }
94 void setStartTimeInternal(double, bool isUpdateFromCompositor = false); 96 void setStartTimeInternal(double, bool isUpdateFromCompositor = false);
95 97
96 const TimedItem* source() const { return m_content.get(); } 98 const TimedItem* source() const { return m_content.get(); }
97 TimedItem* source() { return m_content.get(); } 99 TimedItem* source() { return m_content.get(); }
98 TimedItem* source(bool& isNull) { isNull = !m_content; return m_content.get( ); } 100 TimedItem* source(bool& isNull) { isNull = !m_content; return m_content.get( ); }
(...skipping 19 matching lines...) Expand all
118 120
119 class SortInfo { 121 class SortInfo {
120 public: 122 public:
121 friend class AnimationPlayer; 123 friend class AnimationPlayer;
122 bool operator<(const SortInfo& other) const; 124 bool operator<(const SortInfo& other) const;
123 double startTime() const { return m_startTime; } 125 double startTime() const { return m_startTime; }
124 private: 126 private:
125 SortInfo(unsigned sequenceNumber, double startTime) 127 SortInfo(unsigned sequenceNumber, double startTime)
126 : m_sequenceNumber(sequenceNumber) 128 : m_sequenceNumber(sequenceNumber)
127 , m_startTime(startTime) 129 , m_startTime(startTime)
128 { } 130 {
131 }
129 unsigned m_sequenceNumber; 132 unsigned m_sequenceNumber;
130 double m_startTime; 133 double m_startTime;
131 }; 134 };
132 135
133 const SortInfo& sortInfo() const { return m_sortInfo; } 136 const SortInfo& sortInfo() const { return m_sortInfo; }
134 137
135 static bool hasLowerPriority(AnimationPlayer* player1, AnimationPlayer* play er2) 138 static bool hasLowerPriority(AnimationPlayer* player1, AnimationPlayer* play er2)
136 { 139 {
137 return player1->sortInfo() < player2->sortInfo(); 140 return player1->sortInfo() < player2->sortInfo();
138 } 141 }
139 142
143 #if !ENABLE(OILPAN)
140 // Checks if the AnimationStack is the last reference holder to the Player. 144 // Checks if the AnimationStack is the last reference holder to the Player.
141 // This won't be needed when AnimationPlayer is moved to Oilpan. 145 // This won't be needed when AnimationPlayer is moved to Oilpan.
142 bool canFree() const; 146 bool canFree() const;
147 #endif
143 148
144 virtual bool addEventListener(const AtomicString& eventType, PassRefPtr<Even tListener>, bool useCapture = false) OVERRIDE; 149 virtual bool addEventListener(const AtomicString& eventType, PassRefPtr<Even tListener>, bool useCapture = false) OVERRIDE;
145 150
151 void trace(Visitor*);
152
146 private: 153 private:
147 AnimationPlayer(DocumentTimeline&, TimedItem*); 154 AnimationPlayer(DocumentTimeline&, TimedItem*);
148 double sourceEnd() const; 155 double sourceEnd() const;
149 bool limited(double currentTime) const; 156 bool limited(double currentTime) const;
150 double currentTimeWithoutLag() const; 157 double currentTimeWithoutLag() const;
151 double currentTimeWithLag() const; 158 double currentTimeWithLag() const;
152 void updateTimingState(double newCurrentTime); 159 void updateTimingState(double newCurrentTime);
153 void updateCurrentTimingState(); 160 void updateCurrentTimingState();
154 161
155 double m_playbackRate; 162 double m_playbackRate;
156 double m_startTime; 163 double m_startTime;
157 double m_holdTime; 164 double m_holdTime;
158 double m_storedTimeLag; 165 double m_storedTimeLag;
159 166
160 SortInfo m_sortInfo; 167 SortInfo m_sortInfo;
161 168
162 RefPtr<TimedItem> m_content; 169 RefPtrWillBeMember<TimedItem> m_content;
163 // FIXME: We should keep the timeline alive and have this as non-null 170 // FIXME: We should keep the timeline alive and have this as non-null
164 // but this is tricky to do without Oilpan 171 // but this is tricky to do without Oilpan
165 DocumentTimeline* m_timeline; 172 RawPtrWillBeMember<DocumentTimeline> m_timeline;
166 // Reflects all pausing, including via pauseForTesting(). 173 // Reflects all pausing, including via pauseForTesting().
167 bool m_paused; 174 bool m_paused;
168 bool m_held; 175 bool m_held;
169 bool m_isPausedForTesting; 176 bool m_isPausedForTesting;
170 177
171 // This indicates timing information relevant to the player has changed by 178 // This indicates timing information relevant to the player has changed by
172 // means other than the ordinary progression of time 179 // means other than the ordinary progression of time
173 bool m_outdated; 180 bool m_outdated;
174 181
175 bool m_finished; 182 bool m_finished;
176 }; 183 };
177 184
178 } // namespace 185 } // namespace
179 186
180 #endif 187 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698