| 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_host.h" | 5 #include "cc/animation/animation_host.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 scoped_refptr<ElementAnimations> element_animations = | 223 scoped_refptr<ElementAnimations> element_animations = |
| 224 GetElementAnimationsForLayerId(layer_id); | 224 GetElementAnimationsForLayerId(layer_id); |
| 225 if (!element_animations) { | 225 if (!element_animations) { |
| 226 element_animations = ElementAnimations::Create(); | 226 element_animations = ElementAnimations::Create(); |
| 227 element_animations->SetLayerId(layer_id); | 227 element_animations->SetLayerId(layer_id); |
| 228 RegisterElementAnimations(element_animations.get()); | 228 RegisterElementAnimations(element_animations.get()); |
| 229 } | 229 } |
| 230 | 230 |
| 231 if (element_animations->animation_host() != this) { | 231 if (element_animations->animation_host() != this) { |
| 232 element_animations->SetAnimationHost(this); | 232 element_animations->SetAnimationHost(this); |
| 233 element_animations->InitValueObservations(); | 233 element_animations->InitAffectedElementTypes(); |
| 234 } | 234 } |
| 235 | 235 |
| 236 element_animations->AddPlayer(player); | 236 element_animations->AddPlayer(player); |
| 237 } | 237 } |
| 238 | 238 |
| 239 void AnimationHost::UnregisterPlayerForLayer(int layer_id, | 239 void AnimationHost::UnregisterPlayerForLayer(int layer_id, |
| 240 AnimationPlayer* player) { | 240 AnimationPlayer* player) { |
| 241 DCHECK(layer_id); | 241 DCHECK(layer_id); |
| 242 DCHECK(player); | 242 DCHECK(player); |
| 243 | 243 |
| 244 scoped_refptr<ElementAnimations> element_animations = | 244 scoped_refptr<ElementAnimations> element_animations = |
| 245 GetElementAnimationsForLayerId(layer_id); | 245 GetElementAnimationsForLayerId(layer_id); |
| 246 DCHECK(element_animations); | 246 DCHECK(element_animations); |
| 247 element_animations->RemovePlayer(player); | 247 element_animations->RemovePlayer(player); |
| 248 | 248 |
| 249 if (element_animations->IsEmpty()) { | 249 if (element_animations->IsEmpty()) { |
| 250 element_animations->ClearValueObservations(); | 250 element_animations->ClearAffectedElementTypes(); |
| 251 UnregisterElementAnimations(element_animations.get()); | 251 UnregisterElementAnimations(element_animations.get()); |
| 252 element_animations->SetAnimationHost(nullptr); | 252 element_animations->SetAnimationHost(nullptr); |
| 253 } | 253 } |
| 254 } | 254 } |
| 255 | 255 |
| 256 void AnimationHost::SetMutatorHostClient(MutatorHostClient* client) { | 256 void AnimationHost::SetMutatorHostClient(MutatorHostClient* client) { |
| 257 if (mutator_host_client_ == client) | 257 if (mutator_host_client_ == client) |
| 258 return; | 258 return; |
| 259 | 259 |
| 260 mutator_host_client_ = client; | 260 mutator_host_client_ = client; |
| (...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 691 const AnimationHost::LayerToElementAnimationsMap& | 691 const AnimationHost::LayerToElementAnimationsMap& |
| 692 AnimationHost::all_element_animations_for_testing() const { | 692 AnimationHost::all_element_animations_for_testing() const { |
| 693 return layer_to_element_animations_map_; | 693 return layer_to_element_animations_map_; |
| 694 } | 694 } |
| 695 | 695 |
| 696 void AnimationHost::OnAnimationWaitingForDeletion() { | 696 void AnimationHost::OnAnimationWaitingForDeletion() { |
| 697 animation_waiting_for_deletion_ = true; | 697 animation_waiting_for_deletion_ = true; |
| 698 } | 698 } |
| 699 | 699 |
| 700 } // namespace cc | 700 } // namespace cc |
| OLD | NEW |