OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "cc/animation/animation_timeline.h" | 5 #include "cc/animation/animation_timeline.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "cc/animation/animation_player.h" | 9 #include "cc/animation/animation_player.h" |
10 | 10 |
(...skipping 17 matching lines...) Expand all Loading... |
28 return timeline; | 28 return timeline; |
29 } | 29 } |
30 | 30 |
31 void AnimationTimeline::SetAnimationHost(AnimationHost* animation_host) { | 31 void AnimationTimeline::SetAnimationHost(AnimationHost* animation_host) { |
32 animation_host_ = animation_host; | 32 animation_host_ = animation_host; |
33 for (auto& player : players_) | 33 for (auto& player : players_) |
34 player->SetAnimationHost(animation_host); | 34 player->SetAnimationHost(animation_host); |
35 } | 35 } |
36 | 36 |
37 void AnimationTimeline::AttachPlayer(scoped_refptr<AnimationPlayer> player) { | 37 void AnimationTimeline::AttachPlayer(scoped_refptr<AnimationPlayer> player) { |
38 DCHECK(animation_host_); | |
39 player->SetAnimationHost(animation_host_); | 38 player->SetAnimationHost(animation_host_); |
| 39 |
40 player->SetAnimationTimeline(this); | 40 player->SetAnimationTimeline(this); |
41 players_.push_back(player); | 41 players_.push_back(player); |
42 } | 42 } |
43 | 43 |
44 void AnimationTimeline::DetachPlayer(scoped_refptr<AnimationPlayer> player) { | 44 void AnimationTimeline::DetachPlayer(scoped_refptr<AnimationPlayer> player) { |
45 for (AnimationPlayerList::iterator iter = players_.begin(); | 45 for (AnimationPlayerList::iterator iter = players_.begin(); |
46 iter != players_.end(); ++iter) { | 46 iter != players_.end(); ++iter) { |
47 if (iter->get() != player) | 47 if (iter->get() != player) |
48 continue; | 48 continue; |
49 | 49 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 void AnimationTimeline::PushPropertiesToImplThread( | 111 void AnimationTimeline::PushPropertiesToImplThread( |
112 AnimationTimeline* timeline_impl) { | 112 AnimationTimeline* timeline_impl) { |
113 for (auto& player : players_) { | 113 for (auto& player : players_) { |
114 AnimationPlayer* player_impl = timeline_impl->GetPlayerById(player->id()); | 114 AnimationPlayer* player_impl = timeline_impl->GetPlayerById(player->id()); |
115 if (player_impl) | 115 if (player_impl) |
116 player->PushPropertiesTo(player_impl); | 116 player->PushPropertiesTo(player_impl); |
117 } | 117 } |
118 } | 118 } |
119 | 119 |
120 } // namespace cc | 120 } // namespace cc |
OLD | NEW |