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

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

Powered by Google App Engine
This is Rietveld 408576698