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

Side by Side 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: Remove kEnableNewCompositorAnimations. 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 unified diff | Download patch
OLDNEW
(Empty)
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.
4
5 #include "cc/blink/web_compositor_animation_player_impl.h"
6
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"
12
13 using cc::AnimationPlayer;
14
15 namespace cc_blink {
16
17 WebCompositorAnimationPlayerImpl::WebCompositorAnimationPlayerImpl()
18 : animation_player_(
19 AnimationPlayer::Create(cc::AnimationIdProvider::NextPlayerId())) {
20 }
21
22 WebCompositorAnimationPlayerImpl::~WebCompositorAnimationPlayerImpl() {
23 }
24
25 CC_BLINK_EXPORT cc::AnimationPlayer*
26 WebCompositorAnimationPlayerImpl::animation_player() const {
27 return animation_player_.get();
28 }
29
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());
36 }
37
38 void WebCompositorAnimationPlayerImpl::attachLayer(blink::WebLayer* web_layer) {
39 animation_player_->AttachLayer(web_layer->id());
40 }
41
42 void WebCompositorAnimationPlayerImpl::detachLayer() {
43 animation_player_->DetachLayer();
44 }
45
46 void WebCompositorAnimationPlayerImpl::addAnimation(
47 blink::WebCompositorAnimation* animation) {
48 animation_player_->AddAnimation(
49 static_cast<WebCompositorAnimationImpl*>(animation)->PassAnimation());
50 delete animation;
51 }
52
53 void WebCompositorAnimationPlayerImpl::removeAnimation(int animation_id) {
54 animation_player_->RemoveAnimation(animation_id);
55 }
56
57 void WebCompositorAnimationPlayerImpl::pauseAnimation(int animation_id,
58 double time_offset) {
59 animation_player_->PauseAnimation(animation_id, time_offset);
60 }
61
62 } // namespace cc_blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698