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

Unified Diff: third_party/WebKit/Source/platform/animation/CompositorAnimationPlayer.cpp

Issue 1616653002: CC Animation: Move files from cc_blink to Source/platform/animation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Fix copyrights and years. Created 4 years, 10 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: third_party/WebKit/Source/platform/animation/CompositorAnimationPlayer.cpp
diff --git a/third_party/WebKit/Source/platform/animation/CompositorAnimationPlayer.cpp b/third_party/WebKit/Source/platform/animation/CompositorAnimationPlayer.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..6d3b00d67141cbf485bd43cffe3ecbc4fe985b84
--- /dev/null
+++ b/third_party/WebKit/Source/platform/animation/CompositorAnimationPlayer.cpp
@@ -0,0 +1,75 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "platform/animation/CompositorAnimationPlayer.h"
+
+#include "cc/animation/animation_id_provider.h"
+#include "platform/animation/CompositorAnimation.h"
+#include "platform/animation/WebToCCAnimationDelegateAdapter.h"
+#include "public/platform/WebLayer.h"
+
+namespace blink {
+
+CompositorAnimationPlayer::CompositorAnimationPlayer()
+ : m_animationPlayer(cc::AnimationPlayer::Create(cc::AnimationIdProvider::NextPlayerId()))
+{
+}
+
+CompositorAnimationPlayer::~CompositorAnimationPlayer()
+{
+}
+
+cc::AnimationPlayer* CompositorAnimationPlayer::animationPlayer() const
+{
+ return m_animationPlayer.get();
+}
+
+void CompositorAnimationPlayer::setAnimationDelegate(WebCompositorAnimationDelegate* delegate)
+{
+ if (!delegate) {
+ m_animationDelegateAdapter.reset();
+ m_animationPlayer->set_layer_animation_delegate(nullptr);
+ return;
+ }
+ m_animationDelegateAdapter.reset(new WebToCCAnimationDelegateAdapter(delegate));
+ m_animationPlayer->set_layer_animation_delegate(m_animationDelegateAdapter.get());
+}
+
+void CompositorAnimationPlayer::attachLayer(WebLayer* webLayer)
+{
+ m_animationPlayer->AttachLayer(webLayer->id());
+}
+
+void CompositorAnimationPlayer::detachLayer()
+{
+ m_animationPlayer->DetachLayer();
+}
+
+bool CompositorAnimationPlayer::isLayerAttached() const
+{
+ return m_animationPlayer->layer_id() != 0;
+}
+
+void CompositorAnimationPlayer::addAnimation(CompositorAnimation* animation)
+{
+ m_animationPlayer->AddAnimation(animation->passAnimation());
+ delete animation;
+}
+
+void CompositorAnimationPlayer::removeAnimation(int animationId)
+{
+ m_animationPlayer->RemoveAnimation(animationId);
+}
+
+void CompositorAnimationPlayer::pauseAnimation(int animationId, double timeOffset)
+{
+ m_animationPlayer->PauseAnimation(animationId, timeOffset);
+}
+
+void CompositorAnimationPlayer::abortAnimation(int animationId)
+{
+ m_animationPlayer->AbortAnimation(animationId);
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698