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

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

Issue 1318543009: Oilpan: Partially ship Oilpan for core/animations (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 3 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 #include "wtf/RefCounted.h" 42 #include "wtf/RefCounted.h"
43 #include "wtf/RefPtr.h" 43 #include "wtf/RefPtr.h"
44 #include "wtf/Vector.h" 44 #include "wtf/Vector.h"
45 45
46 namespace blink { 46 namespace blink {
47 47
48 class Document; 48 class Document;
49 class AnimationEffect; 49 class AnimationEffect;
50 50
51 // AnimationTimeline is constructed and owned by Document, and tied to its lifec ycle. 51 // AnimationTimeline is constructed and owned by Document, and tied to its lifec ycle.
52 class CORE_EXPORT AnimationTimeline : public RefCountedWillBeGarbageCollectedFin alized<AnimationTimeline>, public ScriptWrappable { 52 class CORE_EXPORT AnimationTimeline : public GarbageCollectedFinalized<Animation Timeline>, public ScriptWrappable {
53 DEFINE_WRAPPERTYPEINFO(); 53 DEFINE_WRAPPERTYPEINFO();
54 public: 54 public:
55 class PlatformTiming : public NoBaseWillBeGarbageCollectedFinalized<Platform Timing> { 55 class PlatformTiming : public GarbageCollectedFinalized<PlatformTiming> {
56 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED(PlatformTiming);
57 public: 56 public:
58 // Calls AnimationTimeline's wake() method after duration seconds. 57 // Calls AnimationTimeline's wake() method after duration seconds.
59 virtual void wakeAfter(double duration) = 0; 58 virtual void wakeAfter(double duration) = 0;
60 virtual void cancelWake() = 0; 59 virtual void cancelWake() = 0;
61 virtual void serviceOnNextFrame() = 0; 60 virtual void serviceOnNextFrame() = 0;
62 virtual ~PlatformTiming() { } 61 virtual ~PlatformTiming() { }
63 DEFINE_INLINE_VIRTUAL_TRACE() { } 62 DEFINE_INLINE_VIRTUAL_TRACE() { }
64 }; 63 };
65 64
66 static PassRefPtrWillBeRawPtr<AnimationTimeline> create(Document*, PassOwnPt rWillBeRawPtr<PlatformTiming> = nullptr); 65 static AnimationTimeline* create(Document*, PlatformTiming* = nullptr);
67 ~AnimationTimeline(); 66 ~AnimationTimeline();
68 67
69 void serviceAnimations(TimingUpdateReason); 68 void serviceAnimations(TimingUpdateReason);
70 void scheduleNextService(); 69 void scheduleNextService();
71 70
72 Animation* play(AnimationEffect*); 71 Animation* play(AnimationEffect*);
73 WillBeHeapVector<RefPtrWillBeMember<Animation>> getAnimations(); 72 HeapVector<Member<Animation>> getAnimations();
74 73
75 void animationAttached(Animation&); 74 void animationAttached(Animation&);
76 #if !ENABLE(OILPAN)
77 void animationDestroyed(Animation* animation)
78 {
79 ASSERT(m_animations.contains(animation));
80 m_animations.remove(animation);
81 }
82 #endif
83 75
84 bool hasPendingUpdates() const { return !m_animationsNeedingUpdate.isEmpty() ; } 76 bool hasPendingUpdates() const { return !m_animationsNeedingUpdate.isEmpty() ; }
85 double zeroTime(); 77 double zeroTime();
86 double currentTime(bool& isNull); 78 double currentTime(bool& isNull);
87 double currentTime(); 79 double currentTime();
88 double currentTimeInternal(bool& isNull); 80 double currentTimeInternal(bool& isNull);
89 double currentTimeInternal(); 81 double currentTimeInternal();
90 void setCurrentTime(double); 82 void setCurrentTime(double);
91 void setCurrentTimeInternal(double); 83 void setCurrentTimeInternal(double);
92 double effectiveTime(); 84 double effectiveTime();
(...skipping 11 matching lines...) Expand all
104 96
105 Document* document() { return m_document.get(); } 97 Document* document() { return m_document.get(); }
106 #if !ENABLE(OILPAN) 98 #if !ENABLE(OILPAN)
107 void detachFromDocument(); 99 void detachFromDocument();
108 #endif 100 #endif
109 void wake(); 101 void wake();
110 102
111 DECLARE_TRACE(); 103 DECLARE_TRACE();
112 104
113 protected: 105 protected:
114 AnimationTimeline(Document*, PassOwnPtrWillBeRawPtr<PlatformTiming>); 106 AnimationTimeline(Document*, PlatformTiming*);
115 107
116 private: 108 private:
117 RawPtrWillBeMember<Document> m_document; 109 RawPtrWillBeMember<Document> m_document;
118 double m_zeroTime; 110 double m_zeroTime;
119 bool m_zeroTimeInitialized; 111 bool m_zeroTimeInitialized;
120 unsigned m_outdatedAnimationCount; 112 unsigned m_outdatedAnimationCount;
121 // Animations which will be updated on the next frame 113 // Animations which will be updated on the next frame
122 // i.e. current, in effect, or had timing changed 114 // i.e. current, in effect, or had timing changed
123 WillBeHeapHashSet<RefPtrWillBeMember<Animation>> m_animationsNeedingUpdate; 115 HeapHashSet<Member<Animation>> m_animationsNeedingUpdate;
124 WillBeHeapHashSet<RawPtrWillBeWeakMember<Animation>> m_animations; 116 HeapHashSet<WeakMember<Animation>> m_animations;
125 117
126 double m_playbackRate; 118 double m_playbackRate;
127 119
128 friend class SMILTimeContainer; 120 friend class SMILTimeContainer;
129 static const double s_minimumDelay; 121 static const double s_minimumDelay;
130 122
131 OwnPtrWillBeMember<PlatformTiming> m_timing; 123 Member<PlatformTiming> m_timing;
132 double m_lastCurrentTimeInternal; 124 double m_lastCurrentTimeInternal;
133 125
134 OwnPtr<WebCompositorAnimationTimeline> m_compositorTimeline; 126 OwnPtr<WebCompositorAnimationTimeline> m_compositorTimeline;
135 127
136 class AnimationTimelineTiming final : public PlatformTiming { 128 class AnimationTimelineTiming final : public PlatformTiming {
137 public: 129 public:
138 AnimationTimelineTiming(AnimationTimeline* timeline) 130 AnimationTimelineTiming(AnimationTimeline* timeline)
139 : m_timeline(timeline) 131 : m_timeline(timeline)
140 , m_timer(this, &AnimationTimelineTiming::timerFired) 132 , m_timer(this, &AnimationTimelineTiming::timerFired)
141 { 133 {
142 ASSERT(m_timeline); 134 ASSERT(m_timeline);
143 } 135 }
144 136
145 void wakeAfter(double duration) override; 137 void wakeAfter(double duration) override;
146 void cancelWake() override; 138 void cancelWake() override;
147 void serviceOnNextFrame() override; 139 void serviceOnNextFrame() override;
148 140
149 void timerFired(Timer<AnimationTimelineTiming>*) { m_timeline->wake(); } 141 void timerFired(Timer<AnimationTimelineTiming>*) { m_timeline->wake(); }
150 142
151 DECLARE_VIRTUAL_TRACE(); 143 DECLARE_VIRTUAL_TRACE();
152 144
153 private: 145 private:
154 RawPtrWillBeMember<AnimationTimeline> m_timeline; 146 Member<AnimationTimeline> m_timeline;
155 Timer<AnimationTimelineTiming> m_timer; 147 Timer<AnimationTimelineTiming> m_timer;
156 }; 148 };
157 149
158 friend class AnimationAnimationTimelineTest; 150 friend class AnimationAnimationTimelineTest;
159 }; 151 };
160 152
161 } // namespace blink 153 } // namespace blink
162 154
163 #endif 155 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698