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

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: Rebased Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/trees/layer_tree_host.h ('k') | cc/trees/tree_synchronizer_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/layer_tree_host.cc
diff --git a/cc/trees/layer_tree_host.cc b/cc/trees/layer_tree_host.cc
index f77252f73a34a08a5760452ae2508088d888831c..1dd29a934be5d8d23b8b55729183031e7d5996c2 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) {
@@ -1045,43 +1072,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();
}
« no previous file with comments | « cc/trees/layer_tree_host.h ('k') | cc/trees/tree_synchronizer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698