OLD | NEW |
| (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_timeline_impl.h" | |
6 | |
7 #include "cc/animation/animation_id_provider.h" | |
8 #include "cc/animation/animation_player.h" | |
9 #include "cc/animation/animation_timeline.h" | |
10 #include "cc/blink/web_compositor_animation_player_impl.h" | |
11 #include "third_party/WebKit/public/platform/WebCompositorAnimationPlayerClient.
h" | |
12 | |
13 using cc::AnimationTimeline; | |
14 | |
15 namespace cc_blink { | |
16 | |
17 WebCompositorAnimationTimelineImpl::WebCompositorAnimationTimelineImpl() | |
18 : animation_timeline_(AnimationTimeline::Create( | |
19 cc::AnimationIdProvider::NextTimelineId())) { | |
20 } | |
21 | |
22 WebCompositorAnimationTimelineImpl::~WebCompositorAnimationTimelineImpl() { | |
23 } | |
24 | |
25 cc::AnimationTimeline* WebCompositorAnimationTimelineImpl::animation_timeline() | |
26 const { | |
27 return animation_timeline_.get(); | |
28 } | |
29 | |
30 void WebCompositorAnimationTimelineImpl::playerAttached( | |
31 const blink::WebCompositorAnimationPlayerClient& client) { | |
32 if (client.compositorPlayer()) | |
33 animation_timeline_->AttachPlayer( | |
34 static_cast<WebCompositorAnimationPlayerImpl*>( | |
35 client.compositorPlayer())->animation_player()); | |
36 } | |
37 | |
38 void WebCompositorAnimationTimelineImpl::playerDestroyed( | |
39 const blink::WebCompositorAnimationPlayerClient& client) { | |
40 if (client.compositorPlayer()) | |
41 animation_timeline_->DetachPlayer( | |
42 static_cast<WebCompositorAnimationPlayerImpl*>( | |
43 client.compositorPlayer())->animation_player()); | |
44 } | |
45 | |
46 } // namespace cc_blink | |
OLD | NEW |