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

Unified Diff: cc/trees/layer_tree_host.cc

Issue 13465014: LayerTreeHost::SetAnimationEvents should use AnimationRegistrar (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
Index: cc/trees/layer_tree_host.cc
diff --git a/cc/trees/layer_tree_host.cc b/cc/trees/layer_tree_host.cc
index bf2d87cc59df6267f995f12ac41102bd846a1e64..04e10c24ffe2f80291336aeafb0bff13b3fc8346 100644
--- a/cc/trees/layer_tree_host.cc
+++ b/cc/trees/layer_tree_host.cc
@@ -554,9 +554,36 @@ bool LayerTreeHost::CommitRequested() const {
void LayerTreeHost::SetAnimationEvents(scoped_ptr<AnimationEventsVector> events,
base::Time wall_clock_time) {
DCHECK(proxy_->IsMainThread());
- SetAnimationEventsRecursive(*events,
- root_layer_.get(),
- wall_clock_time);
+ AnimationRegistrar::AnimationControllerMap copy =
+ animation_registrar_->active_animation_controllers();
+ for (AnimationRegistrar::AnimationControllerMap::iterator iter = copy.begin();
+ iter != copy.end();
+ ++iter) {
+ for (size_t event_index = 0; event_index < events->size(); ++event_index) {
+ if ((*iter).second->id() == (*events)[event_index].layer_id) {
+ switch ((*events)[event_index].type) {
+ case AnimationEvent::Started:
+ (*iter).second->NotifyAnimationStarted((*events)[event_index],
+ wall_clock_time.ToDoubleT());
+ break;
+
+ case AnimationEvent::Finished:
+ (*iter).second->NotifyAnimationFinished(
+ (*events)[event_index],
+ wall_clock_time.ToDoubleT());
+ break;
+
+ case AnimationEvent::PropertyUpdate:
+ (*iter).second->NotifyAnimationPropertyUpdate(
+ (*events)[event_index]);
+ break;
+
+ default:
+ NOTREACHED();
+ }
+ }
+ }
+ }
}
void LayerTreeHost::SetRootLayer(scoped_refptr<Layer> root_layer) {
@@ -1044,43 +1071,6 @@ void LayerTreeHost::AnimateLayers(base::TimeTicks time) {
}
}
-void LayerTreeHost::SetAnimationEventsRecursive(
- const AnimationEventsVector& events,
- Layer* layer,
- base::Time wall_clock_time) {
- if (!layer)
- return;
-
- for (size_t event_index = 0; event_index < events.size(); ++event_index) {
- if (layer->id() == events[event_index].layer_id) {
- switch (events[event_index].type) {
- case AnimationEvent::Started:
- layer->NotifyAnimationStarted(events[event_index],
- wall_clock_time.ToDoubleT());
- break;
-
- case AnimationEvent::Finished:
- layer->NotifyAnimationFinished(wall_clock_time.ToDoubleT());
- break;
-
- case AnimationEvent::PropertyUpdate:
- layer->NotifyAnimationPropertyUpdate(events[event_index]);
- break;
-
- default:
- NOTREACHED();
- }
- }
- }
-
- for (size_t child_index = 0;
- child_index < layer->children().size();
- ++child_index)
- SetAnimationEventsRecursive(events,
- layer->children()[child_index].get(),
- wall_clock_time);
-}
-
skia::RefPtr<SkPicture> LayerTreeHost::CapturePicture() {
return proxy_->CapturePicture();
}

Powered by Google App Engine
This is Rietveld 408576698