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

Side by Side Diff: third_party/WebKit/Source/core/svg/animation/SMILTimeContainer.h

Issue 2248643003: Simplify time tracking in SMILTimeContainer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: begin() -> start(); touch-up comment Created 4 years, 4 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) 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2008 Apple 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 50
51 void schedule(SVGSMILElement*, SVGElement*, const QualifiedName&); 51 void schedule(SVGSMILElement*, SVGElement*, const QualifiedName&);
52 void unschedule(SVGSMILElement*, SVGElement*, const QualifiedName&); 52 void unschedule(SVGSMILElement*, SVGElement*, const QualifiedName&);
53 void notifyIntervalsChanged(); 53 void notifyIntervalsChanged();
54 54
55 SMILTime elapsed() const; 55 SMILTime elapsed() const;
56 56
57 bool isPaused() const; 57 bool isPaused() const;
58 bool isStarted() const; 58 bool isStarted() const;
59 59
60 void begin(); 60 void start();
61 void pause(); 61 void pause();
62 void resume(); 62 void resume();
63 void setElapsed(SMILTime); 63 void setElapsed(SMILTime);
64 64
65 void serviceAnimations(); 65 void serviceAnimations();
66 bool hasAnimations() const; 66 bool hasAnimations() const;
67 67
68 void setDocumentOrderIndexesDirty() { m_documentOrderIndexesDirty = true; } 68 void setDocumentOrderIndexesDirty() { m_documentOrderIndexesDirty = true; }
69 69
70 // Advance the animation timeline a single frame. 70 // Advance the animation timeline a single frame.
(...skipping 18 matching lines...) Expand all
89 enum AnimationPolicyOnceAction { 89 enum AnimationPolicyOnceAction {
90 // Restart OnceTimer if the timeline is not paused. 90 // Restart OnceTimer if the timeline is not paused.
91 RestartOnceTimerIfNotPaused, 91 RestartOnceTimerIfNotPaused,
92 // Restart OnceTimer. 92 // Restart OnceTimer.
93 RestartOnceTimer, 93 RestartOnceTimer,
94 // Cancel OnceTimer. 94 // Cancel OnceTimer.
95 CancelOnceTimer 95 CancelOnceTimer
96 }; 96 };
97 97
98 bool isTimelineRunning() const; 98 bool isTimelineRunning() const;
99 void scheduleAnimationFrame(SMILTime fireTime); 99 void synchronizeToDocumentTimeline();
100 void scheduleAnimationFrame(double delayTime);
100 void cancelAnimationFrame(); 101 void cancelAnimationFrame();
101 void wakeupTimerFired(TimerBase*); 102 void wakeupTimerFired(TimerBase*);
102 void scheduleAnimationPolicyTimer(); 103 void scheduleAnimationPolicyTimer();
103 void cancelAnimationPolicyTimer(); 104 void cancelAnimationPolicyTimer();
104 void animationPolicyTimerFired(TimerBase*); 105 void animationPolicyTimerFired(TimerBase*);
105 ImageAnimationPolicy animationPolicy() const; 106 ImageAnimationPolicy animationPolicy() const;
106 bool handleAnimationPolicy(AnimationPolicyOnceAction); 107 bool handleAnimationPolicy(AnimationPolicyOnceAction);
107 void updateAnimationsAndScheduleFrameIfNeeded(SMILTime elapsed, bool seekToT ime = false); 108 void updateAnimationsAndScheduleFrameIfNeeded(SMILTime elapsed, bool seekToT ime = false);
108 SMILTime updateAnimations(SMILTime elapsed, bool seekToTime = false); 109 SMILTime updateAnimations(SMILTime elapsed, bool seekToTime = false);
109 void serviceOnNextFrame(); 110 void serviceOnNextFrame();
110 void scheduleWakeUp(double delayTime, FrameSchedulingState); 111 void scheduleWakeUp(double delayTime, FrameSchedulingState);
111 bool hasPendingSynchronization() const; 112 bool hasPendingSynchronization() const;
112 113
113 void updateDocumentOrderIndexes(); 114 void updateDocumentOrderIndexes();
114 double lastResumeTime() const { return m_resumeTime ? m_resumeTime : m_begin Time; }
115 115
116 SVGSVGElement& ownerSVGElement() const; 116 SVGSVGElement& ownerSVGElement() const;
117 Document& document() const; 117 Document& document() const;
118 double currentTime() const;
119 118
120 double m_beginTime; 119 // The latest "restart" time for the time container's timeline. If the
121 double m_pauseTime; 120 // timeline has not been manipulated (seeked, paused) this will be zero.
122 double m_resumeTime; 121 double m_presentationTime;
123 double m_accumulatedActiveTime; 122 // The time on the document timeline corresponding to |m_presentationTime|.
124 double m_presetStartTime; 123 double m_referenceTime;
125 124
126 FrameSchedulingState m_frameSchedulingState; 125 FrameSchedulingState m_frameSchedulingState;
126 bool m_started; // The timeline has been started.
127 bool m_paused; // The timeline is paused.
128
127 bool m_documentOrderIndexesDirty; 129 bool m_documentOrderIndexesDirty;
128 130
129 Timer<SMILTimeContainer> m_wakeupTimer; 131 Timer<SMILTimeContainer> m_wakeupTimer;
130 Timer<SMILTimeContainer> m_animationPolicyOnceTimer; 132 Timer<SMILTimeContainer> m_animationPolicyOnceTimer;
131 133
132 using ElementAttributePair = std::pair<WeakMember<SVGElement>, QualifiedName >; 134 using ElementAttributePair = std::pair<WeakMember<SVGElement>, QualifiedName >;
133 using AnimationsLinkedHashSet = HeapLinkedHashSet<WeakMember<SVGSMILElement> >; 135 using AnimationsLinkedHashSet = HeapLinkedHashSet<WeakMember<SVGSMILElement> >;
134 using GroupedAnimationsMap = HeapHashMap<ElementAttributePair, Member<Animat ionsLinkedHashSet>>; 136 using GroupedAnimationsMap = HeapHashMap<ElementAttributePair, Member<Animat ionsLinkedHashSet>>;
135 GroupedAnimationsMap m_scheduledAnimations; 137 GroupedAnimationsMap m_scheduledAnimations;
136 138
137 Member<SVGSVGElement> m_ownerSVGElement; 139 Member<SVGSVGElement> m_ownerSVGElement;
138 140
139 #if ENABLE(ASSERT) 141 #if ENABLE(ASSERT)
140 bool m_preventScheduledAnimationsChanges; 142 bool m_preventScheduledAnimationsChanges;
141 #endif 143 #endif
142 }; 144 };
143 } // namespace blink 145 } // namespace blink
144 146
145 #endif // SMILTimeContainer_h 147 #endif // SMILTimeContainer_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698