Commit 741f08a4 authored by fs@opera.com's avatar fs@opera.com

Use the Document AnimationClock in SMILTimeContainer

It's trivial to replace the local AnimationClock in SMILTimeContainer
with the one from Document after making the observation that the only
current manipulations (updateTime/unfreeze) are already performed by
PageAnimator (DocumentAnimations::updateAnimationTimingForAnimationFrame)
and RenderLayerCompositor (DocumentAnimations::startPendingAnimations).

With this change it become possible to push the DiscardScope into
updateAnimationsAndScheduleFrameIfNeeded - so do that to simplify the
code (by reducing the number of places that instantiate a DiscardScope.)

BUG=231576

Review URL: https://codereview.chromium.org/198723005

git-svn-id: svn://svn.chromium.org/blink/trunk@169761 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 85007e5e
...@@ -57,7 +57,6 @@ SMILTimeContainer::SMILTimeContainer(SVGSVGElement& owner) ...@@ -57,7 +57,6 @@ SMILTimeContainer::SMILTimeContainer(SVGSVGElement& owner)
, m_presetStartTime(0) , m_presetStartTime(0)
, m_frameSchedulingState(Idle) , m_frameSchedulingState(Idle)
, m_documentOrderIndexesDirty(false) , m_documentOrderIndexesDirty(false)
, m_animationClock(AnimationClock::create())
, m_wakeupTimer(this, &SMILTimeContainer::wakeupTimerFired) , m_wakeupTimer(this, &SMILTimeContainer::wakeupTimerFired)
, m_ownerSVGElement(owner) , m_ownerSVGElement(owner)
#ifndef NDEBUG #ifndef NDEBUG
...@@ -241,7 +240,6 @@ void SMILTimeContainer::setElapsed(SMILTime time) ...@@ -241,7 +240,6 @@ void SMILTimeContainer::setElapsed(SMILTime time)
m_preventScheduledAnimationsChanges = false; m_preventScheduledAnimationsChanges = false;
#endif #endif
DiscardScope discardScope(m_ownerSVGElement);
updateAnimationsAndScheduleFrameIfNeeded(time, true); updateAnimationsAndScheduleFrameIfNeeded(time, true);
} }
...@@ -285,7 +283,6 @@ void SMILTimeContainer::wakeupTimerFired(Timer<SMILTimeContainer>*) ...@@ -285,7 +283,6 @@ void SMILTimeContainer::wakeupTimerFired(Timer<SMILTimeContainer>*)
serviceOnNextFrame(); serviceOnNextFrame();
} else { } else {
m_frameSchedulingState = Idle; m_frameSchedulingState = Idle;
DiscardScope discardScope(m_ownerSVGElement);
updateAnimationsAndScheduleFrameIfNeeded(elapsed()); updateAnimationsAndScheduleFrameIfNeeded(elapsed());
} }
} }
...@@ -320,15 +317,9 @@ Document& SMILTimeContainer::document() const ...@@ -320,15 +317,9 @@ Document& SMILTimeContainer::document() const
return m_ownerSVGElement.document(); return m_ownerSVGElement.document();
} }
AnimationClock& SMILTimeContainer::animationClock() const
{
ASSERT(m_animationClock);
return *m_animationClock;
}
double SMILTimeContainer::currentTime() const double SMILTimeContainer::currentTime() const
{ {
return animationClock().currentTime(); return document().animationClock().currentTime();
} }
void SMILTimeContainer::serviceOnNextFrame() void SMILTimeContainer::serviceOnNextFrame()
...@@ -345,14 +336,12 @@ void SMILTimeContainer::serviceAnimations(double monotonicAnimationStartTime) ...@@ -345,14 +336,12 @@ void SMILTimeContainer::serviceAnimations(double monotonicAnimationStartTime)
return; return;
m_frameSchedulingState = Idle; m_frameSchedulingState = Idle;
animationClock().updateTime(monotonicAnimationStartTime);
DiscardScope discardScope(m_ownerSVGElement);
updateAnimationsAndScheduleFrameIfNeeded(elapsed()); updateAnimationsAndScheduleFrameIfNeeded(elapsed());
animationClock().unfreeze();
} }
void SMILTimeContainer::updateAnimationsAndScheduleFrameIfNeeded(SMILTime elapsed, bool seekToTime) void SMILTimeContainer::updateAnimationsAndScheduleFrameIfNeeded(SMILTime elapsed, bool seekToTime)
{ {
DiscardScope discardScope(m_ownerSVGElement);
SMILTime earliestFireTime = updateAnimations(elapsed, seekToTime); SMILTime earliestFireTime = updateAnimations(elapsed, seekToTime);
// If updateAnimations() ended up triggering a synchronization (most likely // If updateAnimations() ended up triggering a synchronization (most likely
// via syncbases), then give that priority. // via syncbases), then give that priority.
......
...@@ -38,7 +38,6 @@ ...@@ -38,7 +38,6 @@
namespace WebCore { namespace WebCore {
class AnimationClock;
class Document; class Document;
class SVGElement; class SVGElement;
class SVGSMILElement; class SVGSMILElement;
...@@ -96,7 +95,6 @@ private: ...@@ -96,7 +95,6 @@ private:
double lastResumeTime() const { return m_resumeTime ? m_resumeTime : m_beginTime; } double lastResumeTime() const { return m_resumeTime ? m_resumeTime : m_beginTime; }
Document& document() const; Document& document() const;
AnimationClock& animationClock() const;
double currentTime() const; double currentTime() const;
double m_beginTime; double m_beginTime;
...@@ -108,7 +106,6 @@ private: ...@@ -108,7 +106,6 @@ private:
FrameSchedulingState m_frameSchedulingState; FrameSchedulingState m_frameSchedulingState;
bool m_documentOrderIndexesDirty; bool m_documentOrderIndexesDirty;
OwnPtr<AnimationClock> m_animationClock;
Timer<SMILTimeContainer> m_wakeupTimer; Timer<SMILTimeContainer> m_wakeupTimer;
typedef pair<SVGElement*, QualifiedName> ElementAttributePair; typedef pair<SVGElement*, QualifiedName> ElementAttributePair;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment