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

Side by Side Diff: cc/animation/layer_animation_controller.cc

Issue 184433007: Remove wall time from NotifyAnimationStarted and NotifyAnimationFinished. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@remove_wall_time_step2
Patch Set: Fixing unittests for API update. Created 6 years, 9 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 "cc/animation/layer_animation_controller.h" 5 #include "cc/animation/layer_animation_controller.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "cc/animation/animation.h" 9 #include "cc/animation/animation.h"
10 #include "cc/animation/animation_delegate.h" 10 #include "cc/animation/animation_delegate.h"
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 registrar_->UnregisterAnimationController(this); 273 registrar_->UnregisterAnimationController(this);
274 274
275 registrar_ = registrar; 275 registrar_ = registrar;
276 if (registrar_) 276 if (registrar_)
277 registrar_->RegisterAnimationController(this); 277 registrar_->RegisterAnimationController(this);
278 278
279 UpdateActivation(ForceActivation); 279 UpdateActivation(ForceActivation);
280 } 280 }
281 281
282 void LayerAnimationController::NotifyAnimationStarted( 282 void LayerAnimationController::NotifyAnimationStarted(
283 const AnimationEvent& event, 283 const AnimationEvent& event) {
284 double wall_clock_time) {
285 base::TimeTicks monotonic_time = base::TimeTicks::FromInternalValue( 284 base::TimeTicks monotonic_time = base::TimeTicks::FromInternalValue(
286 event.monotonic_time * base::Time::kMicrosecondsPerSecond); 285 event.monotonic_time * base::Time::kMicrosecondsPerSecond);
287 if (event.is_impl_only) { 286 if (event.is_impl_only) {
288 FOR_EACH_OBSERVER(LayerAnimationEventObserver, event_observers_, 287 FOR_EACH_OBSERVER(LayerAnimationEventObserver, event_observers_,
289 OnAnimationStarted(event)); 288 OnAnimationStarted(event));
290 if (layer_animation_delegate_) 289 if (layer_animation_delegate_)
291 layer_animation_delegate_->NotifyAnimationStarted( 290 layer_animation_delegate_->NotifyAnimationStarted(monotonic_time,
292 wall_clock_time, monotonic_time, event.target_property); 291 event.target_property);
293 292
294 return; 293 return;
295 } 294 }
296 295
297 for (size_t i = 0; i < active_animations_.size(); ++i) { 296 for (size_t i = 0; i < active_animations_.size(); ++i) {
298 if (active_animations_[i]->group() == event.group_id && 297 if (active_animations_[i]->group() == event.group_id &&
299 active_animations_[i]->target_property() == event.target_property && 298 active_animations_[i]->target_property() == event.target_property &&
300 active_animations_[i]->needs_synchronized_start_time()) { 299 active_animations_[i]->needs_synchronized_start_time()) {
301 active_animations_[i]->set_needs_synchronized_start_time(false); 300 active_animations_[i]->set_needs_synchronized_start_time(false);
302 active_animations_[i]->set_start_time(event.monotonic_time); 301 active_animations_[i]->set_start_time(event.monotonic_time);
303 302
304 FOR_EACH_OBSERVER(LayerAnimationEventObserver, event_observers_, 303 FOR_EACH_OBSERVER(LayerAnimationEventObserver, event_observers_,
305 OnAnimationStarted(event)); 304 OnAnimationStarted(event));
306 if (layer_animation_delegate_) 305 if (layer_animation_delegate_)
307 layer_animation_delegate_->NotifyAnimationStarted( 306 layer_animation_delegate_->NotifyAnimationStarted(
308 wall_clock_time, monotonic_time, event.target_property); 307 monotonic_time, event.target_property);
309 308
310 return; 309 return;
311 } 310 }
312 } 311 }
313 } 312 }
314 313
315 void LayerAnimationController::NotifyAnimationFinished( 314 void LayerAnimationController::NotifyAnimationFinished(
316 const AnimationEvent& event, 315 const AnimationEvent& event) {
317 double wall_clock_time) {
318 base::TimeTicks monotonic_time = base::TimeTicks::FromInternalValue( 316 base::TimeTicks monotonic_time = base::TimeTicks::FromInternalValue(
319 event.monotonic_time * base::Time::kMicrosecondsPerSecond); 317 event.monotonic_time * base::Time::kMicrosecondsPerSecond);
320 if (event.is_impl_only) { 318 if (event.is_impl_only) {
321 if (layer_animation_delegate_) 319 if (layer_animation_delegate_)
322 layer_animation_delegate_->NotifyAnimationFinished( 320 layer_animation_delegate_->NotifyAnimationFinished(monotonic_time,
323 wall_clock_time, monotonic_time, event.target_property); 321 event.target_property);
324 return; 322 return;
325 } 323 }
326 324
327 for (size_t i = 0; i < active_animations_.size(); ++i) { 325 for (size_t i = 0; i < active_animations_.size(); ++i) {
328 if (active_animations_[i]->group() == event.group_id && 326 if (active_animations_[i]->group() == event.group_id &&
329 active_animations_[i]->target_property() == event.target_property) { 327 active_animations_[i]->target_property() == event.target_property) {
330 active_animations_[i]->set_received_finished_event(true); 328 active_animations_[i]->set_received_finished_event(true);
331 if (layer_animation_delegate_) 329 if (layer_animation_delegate_)
332 layer_animation_delegate_->NotifyAnimationFinished( 330 layer_animation_delegate_->NotifyAnimationFinished(
333 wall_clock_time, monotonic_time, event.target_property); 331 monotonic_time, event.target_property);
334 332
335 return; 333 return;
336 } 334 }
337 } 335 }
338 } 336 }
339 337
340 void LayerAnimationController::NotifyAnimationAborted( 338 void LayerAnimationController::NotifyAnimationAborted(
341 const AnimationEvent& event) { 339 const AnimationEvent& event) {
342 for (size_t i = 0; i < active_animations_.size(); ++i) { 340 for (size_t i = 0; i < active_animations_.size(); ++i) {
343 if (active_animations_[i]->group() == event.group_id && 341 if (active_animations_[i]->group() == event.group_id &&
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
825 value_observers_); 823 value_observers_);
826 LayerAnimationValueObserver* obs; 824 LayerAnimationValueObserver* obs;
827 while ((obs = it.GetNext()) != NULL) 825 while ((obs = it.GetNext()) != NULL)
828 if (obs->IsActive()) 826 if (obs->IsActive())
829 return true; 827 return true;
830 } 828 }
831 return false; 829 return false;
832 } 830 }
833 831
834 } // namespace cc 832 } // namespace cc
OLDNEW
« no previous file with comments | « cc/animation/layer_animation_controller.h ('k') | cc/animation/layer_animation_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698