Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(625)

Side by Side Diff: ui/compositor/layer_animation_sequence.cc

Issue 231133002: CC::Animations should use TimeTicks & TimeDelta to represent time (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Code Refactored as per the comments. Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 const cc::AnimationEvent& event) { 212 const cc::AnimationEvent& event) {
213 if (elements_.empty() || event.group_id != animation_group_id_) 213 if (elements_.empty() || event.group_id != animation_group_id_)
214 return; 214 return;
215 215
216 size_t current_index = last_element_ % elements_.size(); 216 size_t current_index = last_element_ % elements_.size();
217 LayerAnimationElement::AnimatableProperties element_properties = 217 LayerAnimationElement::AnimatableProperties element_properties =
218 elements_[current_index]->properties(); 218 elements_[current_index]->properties();
219 LayerAnimationElement::AnimatableProperty event_property = 219 LayerAnimationElement::AnimatableProperty event_property =
220 LayerAnimationElement::ToAnimatableProperty(event.target_property); 220 LayerAnimationElement::ToAnimatableProperty(event.target_property);
221 DCHECK(element_properties & event_property); 221 DCHECK(element_properties & event_property);
222 elements_[current_index]->set_effective_start_time( 222 elements_[current_index]->set_effective_start_time(event.monotonic_time);
223 base::TimeTicks::FromInternalValue(
224 event.monotonic_time * base::Time::kMicrosecondsPerSecond));
225 } 223 }
226 224
227 void LayerAnimationSequence::OnScheduled() { 225 void LayerAnimationSequence::OnScheduled() {
228 NotifyScheduled(); 226 NotifyScheduled();
229 } 227 }
230 228
231 void LayerAnimationSequence::OnAnimatorDestroyed() { 229 void LayerAnimationSequence::OnAnimatorDestroyed() {
232 if (observers_.might_have_observers()) { 230 if (observers_.might_have_observers()) {
233 ObserverListBase<LayerAnimationObserver>::Iterator it(observers_); 231 ObserverListBase<LayerAnimationObserver>::Iterator it(observers_);
234 LayerAnimationObserver* obs; 232 LayerAnimationObserver* obs;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 272
275 LayerAnimationElement* LayerAnimationSequence::CurrentElement() const { 273 LayerAnimationElement* LayerAnimationSequence::CurrentElement() const {
276 if (elements_.empty()) 274 if (elements_.empty())
277 return NULL; 275 return NULL;
278 276
279 size_t current_index = last_element_ % elements_.size(); 277 size_t current_index = last_element_ % elements_.size();
280 return elements_[current_index].get(); 278 return elements_[current_index].get();
281 } 279 }
282 280
283 } // namespace ui 281 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698