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

Unified Diff: cc/blink/web_compositor_animation_player_impl.cc

Issue 947033002: CC Animations: Establish AnimationHost, AnimationTimeline and AnimationPlayer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Set up impl-only timelines for ScrollOffset animations Created 5 years, 8 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
« no previous file with comments | « cc/blink/web_compositor_animation_player_impl.h ('k') | cc/blink/web_compositor_animation_timeline_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/blink/web_compositor_animation_player_impl.cc
diff --git a/cc/blink/web_compositor_animation_player_impl.cc b/cc/blink/web_compositor_animation_player_impl.cc
new file mode 100644
index 0000000000000000000000000000000000000000..fd146de856fc4ae3d0d41c969ce9bcc23aaa1282
--- /dev/null
+++ b/cc/blink/web_compositor_animation_player_impl.cc
@@ -0,0 +1,66 @@
+// Copyright 2015 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 "cc/blink/web_compositor_animation_player_impl.h"
+
+#include "cc/animation/animation_id_provider.h"
+#include "cc/animation/animation_player.h"
+#include "cc/blink/web_animation_impl.h"
+#include "cc/blink/web_to_cc_animation_delegate_adapter.h"
+#include "third_party/WebKit/public/platform/WebLayer.h"
+
+using cc::AnimationPlayer;
+
+namespace cc_blink {
+
+WebCompositorAnimationPlayerImpl::WebCompositorAnimationPlayerImpl()
+ : animation_player_(
+ AnimationPlayer::Create(cc::AnimationIdProvider::NextPlayerId())) {
+}
+
+WebCompositorAnimationPlayerImpl::~WebCompositorAnimationPlayerImpl() {
+}
+
+CC_BLINK_EXPORT cc::AnimationPlayer*
+WebCompositorAnimationPlayerImpl::animation_player() const {
+ return animation_player_.get();
+}
+
+void WebCompositorAnimationPlayerImpl::setAnimationDelegate(
+ blink::WebCompositorAnimationDelegate* delegate) {
+ animation_delegate_adapter_.reset(
+ new WebToCCAnimationDelegateAdapter(delegate));
+ animation_player_->set_layer_animation_delegate(
+ animation_delegate_adapter_.get());
+}
+
+void WebCompositorAnimationPlayerImpl::attachLayer(blink::WebLayer* web_layer) {
+ animation_player_->AttachLayer(web_layer->id());
+}
+
+void WebCompositorAnimationPlayerImpl::detachLayer() {
+ animation_player_->DetachLayer();
+}
+
+bool WebCompositorAnimationPlayerImpl::isLayerAttached() const {
+ return animation_player_->layer_id() != 0;
+}
+
+void WebCompositorAnimationPlayerImpl::addAnimation(
+ blink::WebCompositorAnimation* animation) {
+ animation_player_->AddAnimation(
+ static_cast<WebCompositorAnimationImpl*>(animation)->PassAnimation());
+ delete animation;
+}
+
+void WebCompositorAnimationPlayerImpl::removeAnimation(int animation_id) {
+ animation_player_->RemoveAnimation(animation_id);
+}
+
+void WebCompositorAnimationPlayerImpl::pauseAnimation(int animation_id,
+ double time_offset) {
+ animation_player_->PauseAnimation(animation_id, time_offset);
+}
+
+} // namespace cc_blink
« no previous file with comments | « cc/blink/web_compositor_animation_player_impl.h ('k') | cc/blink/web_compositor_animation_timeline_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698