| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/compositor/layer_animation_sequence.h" | 5 #include "ui/compositor/layer_animation_sequence.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <iterator> | 8 #include <iterator> |
| 9 | 9 |
| 10 #include "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 LayerAnimationElement::ToAnimatableProperty(target_property); | 225 LayerAnimationElement::ToAnimatableProperty(target_property); |
| 226 DCHECK(element_properties & event_property); | 226 DCHECK(element_properties & event_property); |
| 227 elements_[current_index]->set_effective_start_time(monotonic_time); | 227 elements_[current_index]->set_effective_start_time(monotonic_time); |
| 228 } | 228 } |
| 229 | 229 |
| 230 void LayerAnimationSequence::OnScheduled() { | 230 void LayerAnimationSequence::OnScheduled() { |
| 231 NotifyScheduled(); | 231 NotifyScheduled(); |
| 232 } | 232 } |
| 233 | 233 |
| 234 void LayerAnimationSequence::OnAnimatorDestroyed() { | 234 void LayerAnimationSequence::OnAnimatorDestroyed() { |
| 235 if (observers_.might_have_observers()) { | 235 for (LayerAnimationObserver& observer : observers_) { |
| 236 base::ObserverListBase<LayerAnimationObserver>::Iterator it(&observers_); | 236 if (!observer.RequiresNotificationWhenAnimatorDestroyed()) { |
| 237 LayerAnimationObserver* obs; | 237 // Remove the observer, but do not allow notifications to be sent. |
| 238 while ((obs = it.GetNext()) != NULL) { | 238 observers_.RemoveObserver(&observer); |
| 239 if (!obs->RequiresNotificationWhenAnimatorDestroyed()) { | 239 observer.DetachedFromSequence(this, false); |
| 240 // Remove the observer, but do not allow notifications to be sent. | |
| 241 observers_.RemoveObserver(obs); | |
| 242 obs->DetachedFromSequence(this, false); | |
| 243 } | |
| 244 } | 240 } |
| 245 } | 241 } |
| 246 } | 242 } |
| 247 | 243 |
| 248 size_t LayerAnimationSequence::size() const { | 244 size_t LayerAnimationSequence::size() const { |
| 249 return elements_.size(); | 245 return elements_.size(); |
| 250 } | 246 } |
| 251 | 247 |
| 252 LayerAnimationElement* LayerAnimationSequence::FirstElement() const { | 248 LayerAnimationElement* LayerAnimationSequence::FirstElement() const { |
| 253 if (elements_.empty()) { | 249 if (elements_.empty()) { |
| (...skipping 28 matching lines...) Expand all Loading... |
| 282 | 278 |
| 283 LayerAnimationElement* LayerAnimationSequence::CurrentElement() const { | 279 LayerAnimationElement* LayerAnimationSequence::CurrentElement() const { |
| 284 if (elements_.empty()) | 280 if (elements_.empty()) |
| 285 return NULL; | 281 return NULL; |
| 286 | 282 |
| 287 size_t current_index = last_element_ % elements_.size(); | 283 size_t current_index = last_element_ % elements_.size(); |
| 288 return elements_[current_index].get(); | 284 return elements_[current_index].get(); |
| 289 } | 285 } |
| 290 | 286 |
| 291 } // namespace ui | 287 } // namespace ui |
| OLD | NEW |