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

Side by Side Diff: Source/core/animation/DocumentTimeline.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 18 matching lines...) Expand all
29 */ 29 */
30 30
31 #ifndef DocumentTimeline_h 31 #ifndef DocumentTimeline_h
32 #define DocumentTimeline_h 32 #define DocumentTimeline_h
33 33
34 #include "core/animation/AnimationEffect.h" 34 #include "core/animation/AnimationEffect.h"
35 #include "core/animation/AnimationPlayer.h" 35 #include "core/animation/AnimationPlayer.h"
36 #include "core/dom/Element.h" 36 #include "core/dom/Element.h"
37 #include "core/events/Event.h" 37 #include "core/events/Event.h"
38 #include "platform/Timer.h" 38 #include "platform/Timer.h"
39 #include "platform/heap/Handle.h"
39 #include "wtf/RefCounted.h" 40 #include "wtf/RefCounted.h"
40 #include "wtf/RefPtr.h" 41 #include "wtf/RefPtr.h"
41 #include "wtf/Vector.h" 42 #include "wtf/Vector.h"
42 43
43 namespace WebCore { 44 namespace WebCore {
44 45
45 class Document; 46 class Document;
46 class TimedItem; 47 class TimedItem;
47 48
48 // DocumentTimeline is constructed and owned by Document, and tied to its lifecy cle. 49 // DocumentTimeline is constructed and owned by Document, and tied to its lifecy cle.
49 class DocumentTimeline : public RefCounted<DocumentTimeline> { 50 class DocumentTimeline : public RefCountedWillBeGarbageCollectedFinalized<Docume ntTimeline> {
50 public: 51 public:
51 class PlatformTiming { 52 class PlatformTiming : public NoBaseWillBeGarbageCollectedFinalized<Platform Timing> {
52 53
53 public: 54 public:
54 // Calls DocumentTimeline's wake() method after duration seconds. 55 // Calls DocumentTimeline's wake() method after duration seconds.
55 virtual void wakeAfter(double duration) = 0; 56 virtual void wakeAfter(double duration) = 0;
56 virtual void cancelWake() = 0; 57 virtual void cancelWake() = 0;
57 virtual void serviceOnNextFrame() = 0; 58 virtual void serviceOnNextFrame() = 0;
58 virtual ~PlatformTiming() { } 59 virtual ~PlatformTiming() { }
59 60 virtual void trace(Visitor*) = 0;
Mads Ager (chromium) 2014/05/15 08:36:54 Let's provide a default implementation for trace t
haraken 2014/05/16 07:41:22 Done.
60 }; 61 };
61 62
62 static PassRefPtr<DocumentTimeline> create(Document*, PassOwnPtr<PlatformTim ing> = nullptr); 63 static PassRefPtrWillBeRawPtr<DocumentTimeline> create(Document*, PassOwnPtr WillBeRawPtr<PlatformTiming> = nullptr);
63 ~DocumentTimeline(); 64 ~DocumentTimeline();
64 65
65 void serviceAnimations(TimingUpdateReason); 66 void serviceAnimations(TimingUpdateReason);
66 67
67 // Creates a player attached to this timeline, but without a start time. 68 // Creates a player attached to this timeline, but without a start time.
68 AnimationPlayer* createAnimationPlayer(TimedItem*); 69 AnimationPlayer* createAnimationPlayer(TimedItem*);
69 AnimationPlayer* play(TimedItem*); 70 AnimationPlayer* play(TimedItem*);
70 71
72 #if !ENABLE(OILPAN)
71 void playerDestroyed(AnimationPlayer* player) 73 void playerDestroyed(AnimationPlayer* player)
72 { 74 {
73 ASSERT(m_players.contains(player)); 75 ASSERT(m_players.contains(player));
74 m_players.remove(player); 76 m_players.remove(player);
75 } 77 }
78 #endif
76 79
77 // Called from setReadyState() in Document.cpp to set m_zeroTime to 80 // Called from setReadyState() in Document.cpp to set m_zeroTime to
78 // performance.timing.domInteractive 81 // performance.timing.domInteractive
79 void setZeroTime(double); 82 void setZeroTime(double);
80 bool hasStarted() const { return !isNull(m_zeroTime); } 83 bool hasStarted() const { return !isNull(m_zeroTime); }
81 bool hasPendingUpdates() const { return !m_playersNeedingUpdate.isEmpty(); } 84 bool hasPendingUpdates() const { return !m_playersNeedingUpdate.isEmpty(); }
82 double zeroTime() const { return m_zeroTime; } 85 double zeroTime() const { return m_zeroTime; }
83 double currentTime(bool& isNull); 86 double currentTime(bool& isNull);
84 double currentTime(); 87 double currentTime();
85 double currentTimeInternal(bool& isNull); 88 double currentTimeInternal(bool& isNull);
86 double currentTimeInternal(); 89 double currentTimeInternal();
87 double effectiveTime(); 90 double effectiveTime();
88 void pauseAnimationsForTesting(double); 91 void pauseAnimationsForTesting(double);
89 size_t numberOfActiveAnimationsForTesting() const; 92 size_t numberOfActiveAnimationsForTesting() const;
90 93
91 void setOutdatedAnimationPlayer(AnimationPlayer*); 94 void setOutdatedAnimationPlayer(AnimationPlayer*);
92 bool hasOutdatedAnimationPlayer() const; 95 bool hasOutdatedAnimationPlayer() const;
93 96
94 Document* document() { return m_document; } 97 Document* document() { return m_document.get(); }
98 #if !ENABLE(OILPAN)
95 void detachFromDocument(); 99 void detachFromDocument();
100 #endif
96 void wake(); 101 void wake();
97 102
103 void trace(Visitor*);
104
98 protected: 105 protected:
99 DocumentTimeline(Document*, PassOwnPtr<PlatformTiming>); 106 DocumentTimeline(Document*, PassOwnPtrWillBeRawPtr<PlatformTiming>);
100 107
101 private: 108 private:
102 double m_zeroTime; 109 double m_zeroTime;
103 Document* m_document; 110 RawPtrWillBeMember<Document> m_document;
104 // AnimationPlayers which will be updated on the next frame 111 // AnimationPlayers which will be updated on the next frame
105 // i.e. current, in effect, or had timing changed 112 // i.e. current, in effect, or had timing changed
106 HashSet<RefPtr<AnimationPlayer> > m_playersNeedingUpdate; 113 WillBeHeapHashSet<RefPtrWillBeMember<AnimationPlayer> > m_playersNeedingUpda te;
107 HashSet<AnimationPlayer*> m_players; 114 WillBeHeapHashSet<RawPtrWillBeWeakMember<AnimationPlayer> > m_players;
108 115
109 friend class SMILTimeContainer; 116 friend class SMILTimeContainer;
110 static const double s_minimumDelay; 117 static const double s_minimumDelay;
111 118
112 OwnPtr<PlatformTiming> m_timing; 119 OwnPtrWillBeMember<PlatformTiming> m_timing;
113 120
114 class DocumentTimelineTiming FINAL : public PlatformTiming { 121 class DocumentTimelineTiming FINAL : public PlatformTiming {
115 public: 122 public:
116 DocumentTimelineTiming(DocumentTimeline* documentTimeline) 123 DocumentTimelineTiming(DocumentTimeline* documentTimeline)
117 : m_timeline(documentTimeline) 124 : m_timeline(documentTimeline)
118 , m_timer(this, &DocumentTimelineTiming::timerFired) 125 , m_timer(this, &DocumentTimelineTiming::timerFired)
119 { 126 {
120 ASSERT(m_timeline); 127 ASSERT(m_timeline);
121 } 128 }
122 129
123 virtual void wakeAfter(double duration) OVERRIDE; 130 virtual void wakeAfter(double duration) OVERRIDE;
124 virtual void cancelWake() OVERRIDE; 131 virtual void cancelWake() OVERRIDE;
125 virtual void serviceOnNextFrame() OVERRIDE; 132 virtual void serviceOnNextFrame() OVERRIDE;
126 133
127 void timerFired(Timer<DocumentTimelineTiming>*) { m_timeline->wake(); } 134 void timerFired(Timer<DocumentTimelineTiming>*) { m_timeline->wake(); }
128 135
136 virtual void trace(Visitor*) OVERRIDE;
137
129 private: 138 private:
130 DocumentTimeline* m_timeline; 139 RawPtrWillBeMember<DocumentTimeline> m_timeline;
131 Timer<DocumentTimelineTiming> m_timer; 140 Timer<DocumentTimelineTiming> m_timer;
132
133 }; 141 };
134 142
135 friend class AnimationDocumentTimelineTest; 143 friend class AnimationDocumentTimelineTest;
136 }; 144 };
137 145
138 } // namespace 146 } // namespace
139 147
140 #endif 148 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698