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

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: Created 5 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 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_player.h"
8 #include "cc/blink/web_animation_impl.h"
9 #include "cc/blink/web_to_cc_animation_delegate_adapter.h"
10 #include "third_party/WebKit/public/platform/WebLayer.h"
11
12 using cc::AnimationPlayer;
13
14 namespace cc_blink {
15
16 WebCompositorAnimationPlayerImpl::WebCompositorAnimationPlayerImpl()
17 : animation_player_(AnimationPlayer::Create()) {
18 }
19
20 WebCompositorAnimationPlayerImpl::~WebCompositorAnimationPlayerImpl() {
21 }
22
23 CC_BLINK_EXPORT cc::AnimationPlayer*
24 WebCompositorAnimationPlayerImpl::animation_player() const {
25 return animation_player_.get();
26 }
27
28 void WebCompositorAnimationPlayerImpl::setAnimationDelegate(
29 blink::WebCompositorAnimationDelegate* delegate) {
30 animation_delegate_adapter_.reset(
31 new WebToCCAnimationDelegateAdapter(delegate));
32 animation_player_->set_layer_animation_delegate(
33 animation_delegate_adapter_.get());
34 }
35
36 void WebCompositorAnimationPlayerImpl::attachLayer(blink::WebLayer* web_layer) {
37 animation_player_->AttachLayer(web_layer->id());
38 }
39
40 void WebCompositorAnimationPlayerImpl::detachLayer() {
41 animation_player_->DetachLayer();
42 }
43
44 void WebCompositorAnimationPlayerImpl::addAnimation(
45 blink::WebCompositorAnimation* animation) {
46 animation_player_->AddAnimation(
47 static_cast<WebCompositorAnimationImpl*>(animation)->PassAnimation());
48 delete animation;
49 }
50
51 void WebCompositorAnimationPlayerImpl::removeAnimation(int animation_id) {
52 animation_player_->RemoveAnimation(animation_id);
53 }
54
55 void WebCompositorAnimationPlayerImpl::pauseAnimation(int animation_id,
56 double time_offset) {
57 animation_player_->PauseAnimation(animation_id, time_offset);
58 }
59
60 } // namespace cc_blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698