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

Unified Diff: Source/core/animation/AnimationPlayer.cpp

Issue 946323002: Animations: Introduce compositor AnimationPlayer and AnimationTimeline. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix the order. Created 5 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/animation/AnimationPlayer.cpp
diff --git a/Source/core/animation/AnimationPlayer.cpp b/Source/core/animation/AnimationPlayer.cpp
index cc3f3065687c5a0124970b678301de9cecce50ba..3d275056f10b75469e0eb06676ffbf4dd5d6933e 100644
--- a/Source/core/animation/AnimationPlayer.cpp
+++ b/Source/core/animation/AnimationPlayer.cpp
@@ -39,7 +39,11 @@
#include "core/frame/UseCounter.h"
#include "core/inspector/InspectorInstrumentation.h"
#include "core/inspector/InspectorTraceEvents.h"
+#include "platform/RuntimeEnabledFeatures.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 +95,8 @@ AnimationPlayer::AnimationPlayer(ExecutionContext* executionContext, AnimationTi
, m_currentTimePending(false)
, m_stateIsBeingUpdated(false)
{
+ createCompositorPlayer();
+
if (m_content) {
if (m_content->player()) {
m_content->player()->cancel();
@@ -108,6 +114,8 @@ AnimationPlayer::~AnimationPlayer()
if (m_timeline)
m_timeline->playerDestroyed(this);
#endif
+
+ destroyCompositorPlayer();
}
double AnimationPlayer::sourceEnd() const
@@ -830,6 +838,27 @@ void AnimationPlayer::endUpdatingState()
m_stateIsBeingUpdated = false;
}
+void AnimationPlayer::createCompositorPlayer()
+{
+ if (Platform::current()->compositorSupport() && RuntimeEnabledFeatures::compositorAnimationTimelinesEnabled()) {
dstockwell 2015/03/16 00:11:27 For consistency I think it's best to check the run
loyso (OOO) 2015/03/18 06:59:43 Done.
+ m_compositorPlayer = adoptPtr(Platform::current()->compositorSupport()->createAnimationPlayer());
+ if (m_compositorPlayer)
dstockwell 2015/03/16 00:11:27 How can this be null?
loyso (OOO) 2015/03/18 06:59:43 If chromium side isn't landed and we run with --en
dstockwell 2015/03/18 07:17:18 Yes it sounds like an invalid configuration, just
loyso (OOO) 2015/03/19 02:32:24 Done.
loyso (OOO) 2015/03/24 02:50:56 I recall now! In webkit_unit_tests it crashes. We
loyso (OOO) 2015/03/24 02:55:17 UPDATE: It's ok since we have a flag now :)
+ m_compositorPlayer->setAnimationDelegate(this);
+ }
+}
+
+void AnimationPlayer::destroyCompositorPlayer()
+{
+ if (m_compositorPlayer)
+ m_compositorPlayer->setAnimationDelegate(nullptr);
+ m_compositorPlayer.clear();
+}
+
+void AnimationPlayer::notifyAnimationStarted(double monotonicTime, int group)
+{
+ timeline()->document()->compositorPendingAnimations().notifyCompositorAnimationStarted(monotonicTime, group);
dstockwell 2015/03/16 00:11:27 ASSERT compositorAnimationTimelinesEnabled()
loyso (OOO) 2015/03/18 06:59:43 Done.
+}
+
AnimationPlayer::PlayStateUpdateScope::PlayStateUpdateScope(AnimationPlayer& player, TimingUpdateReason reason, CompositorPendingChange compositorPendingChange)
: m_player(player)
, m_initialPlayState(m_player->playStateInternal())

Powered by Google App Engine
This is Rietveld 408576698