| 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 20 matching lines...) Expand all Loading... |
| 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& kv : id_to_player_map_) | 33 for (auto& kv : id_to_player_map_) |
| 34 kv.second->SetAnimationHost(animation_host); | 34 kv.second->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(player->id()); | 38 DCHECK(player->id()); |
| 39 player->SetAnimationHost(animation_host_); | 39 player->SetAnimationHost(animation_host_); |
| 40 player->SetAnimationTimeline(this); | 40 player->SetAnimationTimeline(this); |
| 41 id_to_player_map_.insert(std::make_pair(player->id(), player)); | 41 id_to_player_map_.insert(std::make_pair(player->id(), std::move(player))); |
| 42 } | 42 } |
| 43 | 43 |
| 44 void AnimationTimeline::DetachPlayer(scoped_refptr<AnimationPlayer> player) { | 44 void AnimationTimeline::DetachPlayer(scoped_refptr<AnimationPlayer> player) { |
| 45 DCHECK(player->id()); | 45 DCHECK(player->id()); |
| 46 ErasePlayer(player); | 46 ErasePlayer(player); |
| 47 id_to_player_map_.erase(player->id()); | 47 id_to_player_map_.erase(player->id()); |
| 48 } | 48 } |
| 49 | 49 |
| 50 AnimationPlayer* AnimationTimeline::GetPlayerById(int player_id) const { | 50 AnimationPlayer* AnimationTimeline::GetPlayerById(int player_id) const { |
| 51 auto f = id_to_player_map_.find(player_id); | 51 auto f = id_to_player_map_.find(player_id); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 AnimationTimeline* timeline_impl) { | 103 AnimationTimeline* timeline_impl) { |
| 104 for (auto& kv : id_to_player_map_) { | 104 for (auto& kv : id_to_player_map_) { |
| 105 AnimationPlayer* player = kv.second.get(); | 105 AnimationPlayer* player = kv.second.get(); |
| 106 AnimationPlayer* player_impl = timeline_impl->GetPlayerById(player->id()); | 106 AnimationPlayer* player_impl = timeline_impl->GetPlayerById(player->id()); |
| 107 if (player_impl) | 107 if (player_impl) |
| 108 player->PushPropertiesTo(player_impl); | 108 player->PushPropertiesTo(player_impl); |
| 109 } | 109 } |
| 110 } | 110 } |
| 111 | 111 |
| 112 } // namespace cc | 112 } // namespace cc |
| OLD | NEW |