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

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

Issue 653563003: cc: Plumb group id through animation creation and start/finish notifications (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
« no previous file with comments | « cc/animation/animation_delegate.h ('k') | cc/animation/layer_animation_controller_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include <vector> 8 #include <vector>
9 9
10 #include "cc/animation/animation.h" 10 #include "cc/animation/animation.h"
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 307
308 UpdateActivation(ForceActivation); 308 UpdateActivation(ForceActivation);
309 } 309 }
310 310
311 void LayerAnimationController::NotifyAnimationStarted( 311 void LayerAnimationController::NotifyAnimationStarted(
312 const AnimationEvent& event) { 312 const AnimationEvent& event) {
313 if (event.is_impl_only) { 313 if (event.is_impl_only) {
314 FOR_EACH_OBSERVER(LayerAnimationEventObserver, event_observers_, 314 FOR_EACH_OBSERVER(LayerAnimationEventObserver, event_observers_,
315 OnAnimationStarted(event)); 315 OnAnimationStarted(event));
316 if (layer_animation_delegate_) 316 if (layer_animation_delegate_)
317 layer_animation_delegate_->NotifyAnimationStarted(event.monotonic_time, 317 layer_animation_delegate_->NotifyAnimationStarted(
318 event.target_property); 318 event.monotonic_time, event.target_property, event.group_id);
319 return; 319 return;
320 } 320 }
321 321
322 for (size_t i = 0; i < animations_.size(); ++i) { 322 for (size_t i = 0; i < animations_.size(); ++i) {
323 if (animations_[i]->group() == event.group_id && 323 if (animations_[i]->group() == event.group_id &&
324 animations_[i]->target_property() == event.target_property && 324 animations_[i]->target_property() == event.target_property &&
325 animations_[i]->needs_synchronized_start_time()) { 325 animations_[i]->needs_synchronized_start_time()) {
326 animations_[i]->set_needs_synchronized_start_time(false); 326 animations_[i]->set_needs_synchronized_start_time(false);
327 if (!animations_[i]->has_set_start_time()) 327 if (!animations_[i]->has_set_start_time())
328 animations_[i]->set_start_time(event.monotonic_time); 328 animations_[i]->set_start_time(event.monotonic_time);
329 329
330 FOR_EACH_OBSERVER(LayerAnimationEventObserver, event_observers_, 330 FOR_EACH_OBSERVER(LayerAnimationEventObserver, event_observers_,
331 OnAnimationStarted(event)); 331 OnAnimationStarted(event));
332 if (layer_animation_delegate_) 332 if (layer_animation_delegate_)
333 layer_animation_delegate_->NotifyAnimationStarted( 333 layer_animation_delegate_->NotifyAnimationStarted(
334 event.monotonic_time, event.target_property); 334 event.monotonic_time, event.target_property, event.group_id);
335 335
336 return; 336 return;
337 } 337 }
338 } 338 }
339 } 339 }
340 340
341 void LayerAnimationController::NotifyAnimationFinished( 341 void LayerAnimationController::NotifyAnimationFinished(
342 const AnimationEvent& event) { 342 const AnimationEvent& event) {
343 if (event.is_impl_only) { 343 if (event.is_impl_only) {
344 if (layer_animation_delegate_) 344 if (layer_animation_delegate_)
345 layer_animation_delegate_->NotifyAnimationFinished(event.monotonic_time, 345 layer_animation_delegate_->NotifyAnimationFinished(
346 event.target_property); 346 event.monotonic_time, event.target_property, event.group_id);
347 return; 347 return;
348 } 348 }
349 349
350 for (size_t i = 0; i < animations_.size(); ++i) { 350 for (size_t i = 0; i < animations_.size(); ++i) {
351 if (animations_[i]->group() == event.group_id && 351 if (animations_[i]->group() == event.group_id &&
352 animations_[i]->target_property() == event.target_property) { 352 animations_[i]->target_property() == event.target_property) {
353 animations_[i]->set_received_finished_event(true); 353 animations_[i]->set_received_finished_event(true);
354 if (layer_animation_delegate_) 354 if (layer_animation_delegate_)
355 layer_animation_delegate_->NotifyAnimationFinished( 355 layer_animation_delegate_->NotifyAnimationFinished(
356 event.monotonic_time, event.target_property); 356 event.monotonic_time, event.target_property, event.group_id);
357 357
358 return; 358 return;
359 } 359 }
360 } 360 }
361 } 361 }
362 362
363 void LayerAnimationController::NotifyAnimationAborted( 363 void LayerAnimationController::NotifyAnimationAborted(
364 const AnimationEvent& event) { 364 const AnimationEvent& event) {
365 for (size_t i = 0; i < animations_.size(); ++i) { 365 for (size_t i = 0; i < animations_.size(); ++i) {
366 if (animations_[i]->group() == event.group_id && 366 if (animations_[i]->group() == event.group_id &&
(...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after
1028 value_observers_); 1028 value_observers_);
1029 LayerAnimationValueObserver* obs; 1029 LayerAnimationValueObserver* obs;
1030 while ((obs = it.GetNext()) != nullptr) 1030 while ((obs = it.GetNext()) != nullptr)
1031 if (obs->IsActive()) 1031 if (obs->IsActive())
1032 return true; 1032 return true;
1033 } 1033 }
1034 return false; 1034 return false;
1035 } 1035 }
1036 1036
1037 } // namespace cc 1037 } // namespace cc
OLDNEW
« no previous file with comments | « cc/animation/animation_delegate.h ('k') | cc/animation/layer_animation_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698