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