Use md5_check in proguard.py to detect when it's not really necessary
[chromium-blink-merge.git] / cc / blink / web_compositor_animation_player_impl.cc
blobfd146de856fc4ae3d0d41c969ce9bcc23aaa1282
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "cc/blink/web_compositor_animation_player_impl.h"
7 #include "cc/animation/animation_id_provider.h"
8 #include "cc/animation/animation_player.h"
9 #include "cc/blink/web_animation_impl.h"
10 #include "cc/blink/web_to_cc_animation_delegate_adapter.h"
11 #include "third_party/WebKit/public/platform/WebLayer.h"
13 using cc::AnimationPlayer;
15 namespace cc_blink {
17 WebCompositorAnimationPlayerImpl::WebCompositorAnimationPlayerImpl()
18 : animation_player_(
19 AnimationPlayer::Create(cc::AnimationIdProvider::NextPlayerId())) {
22 WebCompositorAnimationPlayerImpl::~WebCompositorAnimationPlayerImpl() {
25 CC_BLINK_EXPORT cc::AnimationPlayer*
26 WebCompositorAnimationPlayerImpl::animation_player() const {
27 return animation_player_.get();
30 void WebCompositorAnimationPlayerImpl::setAnimationDelegate(
31 blink::WebCompositorAnimationDelegate* delegate) {
32 animation_delegate_adapter_.reset(
33 new WebToCCAnimationDelegateAdapter(delegate));
34 animation_player_->set_layer_animation_delegate(
35 animation_delegate_adapter_.get());
38 void WebCompositorAnimationPlayerImpl::attachLayer(blink::WebLayer* web_layer) {
39 animation_player_->AttachLayer(web_layer->id());
42 void WebCompositorAnimationPlayerImpl::detachLayer() {
43 animation_player_->DetachLayer();
46 bool WebCompositorAnimationPlayerImpl::isLayerAttached() const {
47 return animation_player_->layer_id() != 0;
50 void WebCompositorAnimationPlayerImpl::addAnimation(
51 blink::WebCompositorAnimation* animation) {
52 animation_player_->AddAnimation(
53 static_cast<WebCompositorAnimationImpl*>(animation)->PassAnimation());
54 delete animation;
57 void WebCompositorAnimationPlayerImpl::removeAnimation(int animation_id) {
58 animation_player_->RemoveAnimation(animation_id);
61 void WebCompositorAnimationPlayerImpl::pauseAnimation(int animation_id,
62 double time_offset) {
63 animation_player_->PauseAnimation(animation_id, time_offset);
66 } // namespace cc_blink