| 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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 observer->AttachedToSequence(this); | 205 observer->AttachedToSequence(this); |
| 206 } | 206 } |
| 207 } | 207 } |
| 208 | 208 |
| 209 void LayerAnimationSequence::RemoveObserver(LayerAnimationObserver* observer) { | 209 void LayerAnimationSequence::RemoveObserver(LayerAnimationObserver* observer) { |
| 210 observers_.RemoveObserver(observer); | 210 observers_.RemoveObserver(observer); |
| 211 observer->DetachedFromSequence(this, true); | 211 observer->DetachedFromSequence(this, true); |
| 212 } | 212 } |
| 213 | 213 |
| 214 void LayerAnimationSequence::OnThreadedAnimationStarted( | 214 void LayerAnimationSequence::OnThreadedAnimationStarted( |
| 215 const cc::AnimationEvent& event) { | 215 base::TimeTicks monotonic_time, |
| 216 if (elements_.empty() || event.group_id != animation_group_id_) | 216 cc::TargetProperty::Type target_property, |
| 217 int group_id) { |
| 218 if (elements_.empty() || group_id != animation_group_id_) |
| 217 return; | 219 return; |
| 218 | 220 |
| 219 size_t current_index = last_element_ % elements_.size(); | 221 size_t current_index = last_element_ % elements_.size(); |
| 220 LayerAnimationElement::AnimatableProperties element_properties = | 222 LayerAnimationElement::AnimatableProperties element_properties = |
| 221 elements_[current_index]->properties(); | 223 elements_[current_index]->properties(); |
| 222 LayerAnimationElement::AnimatableProperty event_property = | 224 LayerAnimationElement::AnimatableProperty event_property = |
| 223 LayerAnimationElement::ToAnimatableProperty(event.target_property); | 225 LayerAnimationElement::ToAnimatableProperty(target_property); |
| 224 DCHECK(element_properties & event_property); | 226 DCHECK(element_properties & event_property); |
| 225 elements_[current_index]->set_effective_start_time(event.monotonic_time); | 227 elements_[current_index]->set_effective_start_time(monotonic_time); |
| 226 } | 228 } |
| 227 | 229 |
| 228 void LayerAnimationSequence::OnScheduled() { | 230 void LayerAnimationSequence::OnScheduled() { |
| 229 NotifyScheduled(); | 231 NotifyScheduled(); |
| 230 } | 232 } |
| 231 | 233 |
| 232 void LayerAnimationSequence::OnAnimatorDestroyed() { | 234 void LayerAnimationSequence::OnAnimatorDestroyed() { |
| 233 if (observers_.might_have_observers()) { | 235 if (observers_.might_have_observers()) { |
| 234 base::ObserverListBase<LayerAnimationObserver>::Iterator it(&observers_); | 236 base::ObserverListBase<LayerAnimationObserver>::Iterator it(&observers_); |
| 235 LayerAnimationObserver* obs; | 237 LayerAnimationObserver* obs; |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 | 282 |
| 281 LayerAnimationElement* LayerAnimationSequence::CurrentElement() const { | 283 LayerAnimationElement* LayerAnimationSequence::CurrentElement() const { |
| 282 if (elements_.empty()) | 284 if (elements_.empty()) |
| 283 return NULL; | 285 return NULL; |
| 284 | 286 |
| 285 size_t current_index = last_element_ % elements_.size(); | 287 size_t current_index = last_element_ % elements_.size(); |
| 286 return elements_[current_index].get(); | 288 return elements_[current_index].get(); |
| 287 } | 289 } |
| 288 | 290 |
| 289 } // namespace ui | 291 } // namespace ui |
| OLD | NEW |