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

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

Issue 179293004: Drive SVG Animations via requestAnimationFrame (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Use AnimationClock. Created 6 years, 9 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) 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 20 matching lines...) Expand all
31 #include "platform/Timer.h" 31 #include "platform/Timer.h"
32 #include "wtf/HashMap.h" 32 #include "wtf/HashMap.h"
33 #include "wtf/HashSet.h" 33 #include "wtf/HashSet.h"
34 #include "wtf/PassRefPtr.h" 34 #include "wtf/PassRefPtr.h"
35 #include "wtf/RefCounted.h" 35 #include "wtf/RefCounted.h"
36 #include "wtf/text/StringHash.h" 36 #include "wtf/text/StringHash.h"
37 #include "wtf/text/WTFString.h" 37 #include "wtf/text/WTFString.h"
38 38
39 namespace WebCore { 39 namespace WebCore {
40 40
41 class AnimationClock;
42 class Document;
41 class SVGElement; 43 class SVGElement;
42 class SVGSMILElement; 44 class SVGSMILElement;
43 class SVGSVGElement; 45 class SVGSVGElement;
44 46
45 class SMILTimeContainer : public RefCounted<SMILTimeContainer> { 47 class SMILTimeContainer : public RefCounted<SMILTimeContainer> {
46 public: 48 public:
47 static PassRefPtr<SMILTimeContainer> create(SVGSVGElement* owner) { return a doptRef(new SMILTimeContainer(owner)); } 49 static PassRefPtr<SMILTimeContainer> create(SVGSVGElement* owner) { return a doptRef(new SMILTimeContainer(owner)); }
48 ~SMILTimeContainer(); 50 ~SMILTimeContainer();
49 51
50 void schedule(SVGSMILElement*, SVGElement*, const QualifiedName&); 52 void schedule(SVGSMILElement*, SVGElement*, const QualifiedName&);
51 void unschedule(SVGSMILElement*, SVGElement*, const QualifiedName&); 53 void unschedule(SVGSMILElement*, SVGElement*, const QualifiedName&);
52 void notifyIntervalsChanged(); 54 void notifyIntervalsChanged();
53 55
54 SMILTime elapsed() const; 56 SMILTime elapsed() const;
55 57
56 bool isPaused() const; 58 bool isPaused() const;
57 bool isStarted() const; 59 bool isStarted() const;
58 60
59 void begin(); 61 void begin();
60 void pause(); 62 void pause();
61 void resume(); 63 void resume();
62 void setElapsed(SMILTime); 64 void setElapsed(SMILTime);
63 65
66 void serviceAnimations(double monotonicAnimationStartTime);
67 bool hasAnimations() const;
68
64 void setDocumentOrderIndexesDirty() { m_documentOrderIndexesDirty = true; } 69 void setDocumentOrderIndexesDirty() { m_documentOrderIndexesDirty = true; }
65 70
66 private: 71 private:
67 SMILTimeContainer(SVGSVGElement* owner); 72 SMILTimeContainer(SVGSVGElement* owner);
68 73
69 bool isTimelineRunning() const; 74 bool isTimelineRunning() const;
70 void scheduleAnimationFrame(SMILTime fireTime); 75 void scheduleAnimationFrame(SMILTime fireTime);
71 void scheduleAnimationFrame(); 76 void scheduleAnimationFrame();
72 void cancelAnimationFrame(); 77 void cancelAnimationFrame();
73 void timerFired(Timer<SMILTimeContainer>*); 78 void wakeupTimerFired(Timer<SMILTimeContainer>*);
74 void updateAnimations(SMILTime elapsed, bool seekToTime = false); 79 void updateAnimations(SMILTime elapsed, bool seekToTime = false);
80 void serviceOnNextFrame();
75 81
76 void updateDocumentOrderIndexes(); 82 void updateDocumentOrderIndexes();
77 double lastResumeTime() const { return m_resumeTime ? m_resumeTime : m_begin Time; } 83 double lastResumeTime() const { return m_resumeTime ? m_resumeTime : m_begin Time; }
78 84
85 Document& document() const;
86
79 double m_beginTime; 87 double m_beginTime;
80 double m_pauseTime; 88 double m_pauseTime;
81 double m_resumeTime; 89 double m_resumeTime;
82 double m_accumulatedActiveTime; 90 double m_accumulatedActiveTime;
83 double m_presetStartTime; 91 double m_presetStartTime;
84 92
85 bool m_documentOrderIndexesDirty; 93 bool m_documentOrderIndexesDirty;
94 bool m_framePending;
86 95
87 Timer<SMILTimeContainer> m_timer; 96 OwnPtr<AnimationClock> m_animationClock;
97 Timer<SMILTimeContainer> m_wakeupTimer;
88 98
89 typedef pair<SVGElement*, QualifiedName> ElementAttributePair; 99 typedef pair<SVGElement*, QualifiedName> ElementAttributePair;
90 typedef Vector<SVGSMILElement*> AnimationsVector; 100 typedef Vector<SVGSMILElement*> AnimationsVector;
91 typedef HashMap<ElementAttributePair, OwnPtr<AnimationsVector> > GroupedAnim ationsMap; 101 typedef HashMap<ElementAttributePair, OwnPtr<AnimationsVector> > GroupedAnim ationsMap;
92 GroupedAnimationsMap m_scheduledAnimations; 102 GroupedAnimationsMap m_scheduledAnimations;
93 103
94 SVGSVGElement* m_ownerSVGElement; 104 SVGSVGElement* m_ownerSVGElement;
95 105
96 #ifndef NDEBUG 106 #ifndef NDEBUG
97 bool m_preventScheduledAnimationsChanges; 107 bool m_preventScheduledAnimationsChanges;
98 #endif 108 #endif
99 }; 109 };
100 } 110 }
101 111
102 #endif // SMILTimeContainer_h 112 #endif // SMILTimeContainer_h
OLDNEW
« no previous file with comments | « Source/core/svg/SVGDocumentExtensions.cpp ('k') | Source/core/svg/animation/SMILTimeContainer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698