Chromium Code Reviews| Index: Source/core/animation/AnimationPlayer.cpp |
| diff --git a/Source/core/animation/AnimationPlayer.cpp b/Source/core/animation/AnimationPlayer.cpp |
| index c3e08adab9d18a0f513c970c60f6bdd63089227d..98f3976c89cdd0b4b5919bb46dba6ea4d2a12cf3 100644 |
| --- a/Source/core/animation/AnimationPlayer.cpp |
| +++ b/Source/core/animation/AnimationPlayer.cpp |
| @@ -40,6 +40,9 @@ |
| #include "core/inspector/InspectorInstrumentation.h" |
| #include "core/inspector/InspectorTraceEvents.h" |
| #include "platform/TraceEvent.h" |
| +#include "public/platform/Platform.h" |
| +#include "public/platform/WebCompositorAnimationPlayer.h" |
| +#include "public/platform/WebCompositorSupport.h" |
| #include "wtf/MathExtras.h" |
| namespace blink { |
| @@ -91,6 +94,8 @@ AnimationPlayer::AnimationPlayer(ExecutionContext* executionContext, AnimationTi |
| , m_currentTimePending(false) |
| , m_stateIsBeingUpdated(false) |
| { |
| + createCompositorPlayer(); |
|
dstockwell
2015/02/26 00:07:12
Why do we always create a compositor player? Seems
loyso (OOO)
2015/02/26 03:24:57
Because draft. In reality we must know beforehand,
|
| + |
| if (m_content) { |
| if (m_content->player()) { |
| m_content->player()->cancel(); |
| @@ -108,6 +113,8 @@ AnimationPlayer::~AnimationPlayer() |
| if (m_timeline) |
| m_timeline->playerDestroyed(this); |
| #endif |
| + |
| + destroyCompositorPlayer(); |
| } |
| double AnimationPlayer::sourceEnd() const |
| @@ -353,6 +360,30 @@ bool AnimationPlayer::affects(const Element& element, CSSPropertyID property) co |
| return (animation->target() == &element) && animation->affects(property); |
| } |
| +void AnimationPlayer::notifyAnimationStarted(double monotonicTime, int group) |
| +{ |
| + timeline()->document()->compositorPendingAnimations().notifyCompositorAnimationStarted(monotonicTime, group); |
| +} |
| + |
| +void AnimationPlayer::notifyAnimationFinished(double monotonicTime, int group) |
| +{ |
| +} |
| + |
| +void AnimationPlayer::createCompositorPlayer() |
| +{ |
| + if (Platform::current()->compositorSupport()) { |
| + m_compositorPlayer = adoptPtr(Platform::current()->compositorSupport()->createAnimationPlayer()); |
| + m_compositorPlayer->setAnimationDelegate(this); |
| + } |
| +} |
| + |
| +void AnimationPlayer::destroyCompositorPlayer() |
| +{ |
| + if (m_compositorPlayer) |
| + m_compositorPlayer->setAnimationDelegate(nullptr); |
| + m_compositorPlayer.clear(); |
| +} |
| + |
| double AnimationPlayer::calculateStartTime(double currentTime) const |
| { |
| return m_timeline->effectiveTime() - currentTime / m_playbackRate; |