| Index: sky/engine/core/animation/AnimationPlayer.cpp
|
| diff --git a/sky/engine/core/animation/AnimationPlayer.cpp b/sky/engine/core/animation/AnimationPlayer.cpp
|
| index 6e9828f2bc9553a17e2d149f72b84502deb3342b..b21a3d01a5df800f50283b4c6f8dc1b9a4e781b0 100644
|
| --- a/sky/engine/core/animation/AnimationPlayer.cpp
|
| +++ b/sky/engine/core/animation/AnimationPlayer.cpp
|
| @@ -70,7 +70,6 @@ AnimationPlayer::AnimationPlayer(ExecutionContext* executionContext, AnimationTi
|
| , m_isPausedForTesting(false)
|
| , m_outdated(true)
|
| , m_finished(false)
|
| - , m_compositorState(nullptr)
|
| , m_compositorPending(true)
|
| , m_currentTimePending(false)
|
| {
|
| @@ -163,93 +162,18 @@ double AnimationPlayer::currentTimeInternal()
|
|
|
| void AnimationPlayer::preCommit(bool startOnCompositor)
|
| {
|
| - if (m_compositorState && m_compositorState->pendingAction == Start) {
|
| - // Still waiting for a start time.
|
| - return;
|
| - }
|
| -
|
| - bool softChange = m_compositorState && (paused() || m_compositorState->playbackRate != m_playbackRate);
|
| - bool hardChange = m_compositorState && (m_compositorState->sourceChanged || (m_compositorState->startTime != m_startTime && !std::isnan(m_compositorState->startTime) && !std::isnan(m_startTime)));
|
| -
|
| - // FIXME: softChange && !hardChange should generate a Pause/ThenStart,
|
| - // not a Cancel, but we can't communicate these to the compositor yet.
|
| -
|
| - bool changed = softChange || hardChange;
|
| - bool shouldCancel = (!playing() && m_compositorState) || changed;
|
| - bool shouldStart = playing() && (!m_compositorState || changed);
|
| -
|
| - if (shouldCancel) {
|
| - cancelAnimationOnCompositor();
|
| - m_compositorState = nullptr;
|
| -
|
| - }
|
| -
|
| - if (!shouldStart) {
|
| + if (!playing()) {
|
| m_currentTimePending = false;
|
| }
|
| -
|
| - if (shouldStart && startOnCompositor && maybeStartAnimationOnCompositor()) {
|
| - m_compositorState = adoptPtr(new CompositorState(*this));
|
| - }
|
| }
|
|
|
| void AnimationPlayer::postCommit(double timelineTime)
|
| {
|
| m_compositorPending = false;
|
| -
|
| - if (!m_compositorState || m_compositorState->pendingAction == None)
|
| - return;
|
| -
|
| - switch (m_compositorState->pendingAction) {
|
| - case Start:
|
| - if (!std::isnan(m_compositorState->startTime)) {
|
| - ASSERT(m_startTime == m_compositorState->startTime);
|
| - m_compositorState->pendingAction = None;
|
| - }
|
| - break;
|
| - case Pause:
|
| - case PauseThenStart:
|
| - ASSERT(std::isnan(m_startTime));
|
| - m_compositorState->pendingAction = None;
|
| - setCurrentTimeInternal((timelineTime - m_compositorState->startTime) * m_playbackRate, TimingUpdateForAnimationFrame);
|
| - m_currentTimePending = false;
|
| - break;
|
| - default:
|
| - ASSERT_NOT_REACHED();
|
| - }
|
| }
|
|
|
| void AnimationPlayer::notifyCompositorStartTime(double timelineTime)
|
| {
|
| - if (m_compositorState) {
|
| - ASSERT(m_compositorState->pendingAction == Start);
|
| - ASSERT(std::isnan(m_compositorState->startTime));
|
| -
|
| - double initialCompositorHoldTime = m_compositorState->holdTime;
|
| - m_compositorState->pendingAction = None;
|
| - m_compositorState->startTime = timelineTime;
|
| -
|
| - if (paused() || m_compositorState->playbackRate != m_playbackRate || m_compositorState->sourceChanged) {
|
| - // Paused state, playback rate, or source changed while starting.
|
| - setCompositorPending();
|
| - }
|
| -
|
| - if (m_startTime == timelineTime) {
|
| - // The start time was set to the incoming compositor start time.
|
| - // Unlikely, but possible.
|
| - // FIXME: Depending on what changed above this might still be pending.
|
| - // Maybe...
|
| - m_currentTimePending = false;
|
| - return;
|
| - }
|
| -
|
| - if (!std::isnan(m_startTime) || currentTimeInternal() != initialCompositorHoldTime) {
|
| - // A new start time or current time was set while starting.
|
| - setCompositorPending();
|
| - return;
|
| - }
|
| - }
|
| -
|
| if (playing()) {
|
| ASSERT(std::isnan(m_startTime));
|
| ASSERT(m_held);
|
| @@ -535,56 +459,14 @@ void AnimationPlayer::setOutdated()
|
| m_timeline->setOutdatedAnimationPlayer(this);
|
| }
|
|
|
| -bool AnimationPlayer::canStartAnimationOnCompositor()
|
| -{
|
| - // FIXME: Need compositor support for playback rate != 1.
|
| - if (playbackRate() != 1)
|
| - return false;
|
| -
|
| - return m_timeline && m_content && m_content->isAnimation() && playing();
|
| -}
|
| -
|
| -bool AnimationPlayer::maybeStartAnimationOnCompositor()
|
| -{
|
| - if (!canStartAnimationOnCompositor())
|
| - return false;
|
| -
|
| - double startTime = timeline()->zeroTime() + startTimeInternal();
|
| - double timeOffset = 0;
|
| - if (std::isnan(startTime)) {
|
| - timeOffset = currentTimeInternal();
|
| - }
|
| - return toAnimation(m_content.get())->maybeStartAnimationOnCompositor(startTime, timeOffset);
|
| -}
|
| -
|
| void AnimationPlayer::setCompositorPending(bool sourceChanged)
|
| {
|
| - // FIXME: Animation could notify this directly?
|
| - if (!hasActiveAnimationsOnCompositor()) {
|
| - m_compositorState.release();
|
| - }
|
| if (!m_compositorPending) {
|
| m_compositorPending = true;
|
| - if (sourceChanged && m_compositorState)
|
| - m_compositorState->sourceChanged = true;
|
| timeline()->document()->compositorPendingAnimations().add(this);
|
| }
|
| }
|
|
|
| -bool AnimationPlayer::hasActiveAnimationsOnCompositor()
|
| -{
|
| - if (!m_content || !m_content->isAnimation())
|
| - return false;
|
| -
|
| - return toAnimation(m_content.get())->hasActiveAnimationsOnCompositor();
|
| -}
|
| -
|
| -void AnimationPlayer::cancelAnimationOnCompositor()
|
| -{
|
| - if (hasActiveAnimationsOnCompositor())
|
| - toAnimation(m_content.get())->cancelAnimationOnCompositor();
|
| -}
|
| -
|
| bool AnimationPlayer::update(TimingUpdateReason reason)
|
| {
|
| if (!m_timeline)
|
| @@ -644,14 +526,4 @@ bool AnimationPlayer::addEventListener(const AtomicString& eventType, PassRefPtr
|
| return EventTargetWithInlineData::addEventListener(eventType, listener, useCapture);
|
| }
|
|
|
| -void AnimationPlayer::pauseForTesting(double pauseTime)
|
| -{
|
| - RELEASE_ASSERT(!paused());
|
| - setCurrentTimeInternal(pauseTime, TimingUpdateOnDemand);
|
| - if (hasActiveAnimationsOnCompositor())
|
| - toAnimation(m_content.get())->pauseAnimationForTestingOnCompositor(currentTimeInternal());
|
| - m_isPausedForTesting = true;
|
| - pause();
|
| -}
|
| -
|
| } // namespace
|
|
|