cc: Fix post-commit property tree update for animations
commite7425277e33dd626227dc7aaf93ee6ddbed48f68
authorajuma <ajuma@chromium.org>
Mon, 13 Jul 2015 18:37:34 +0000 (13 11:37 -0700)
committerCommit bot <commit-bot@chromium.org>
Mon, 13 Jul 2015 18:38:17 +0000 (13 18:38 +0000)
treeb775b75f683cba6e0b42cf311d2d09e7c234c5a1
parent6824eb61d14a8306d93498897dec46deaf7e390b
cc: Fix post-commit property tree update for animations

After a commit, property tree nodes corresponding to animated layers
have their values updated during a layer tree walk, to handle the
case where the most recent compositor thread animation tick happened
at a different time than the most recent main thread tick. This CL
fixes two problems with this update:

1) An animation that's running at the start of a BeginMainFrame may
finish on the compositor thread before the commit. In this situation,
the property tree still needs to updated after commit. The current
logic used by LayerImpl to decide whether an update is needed involves
calling TransformIsAnimating or OpacityIsAnimating, but these will
be false since the animation has finished. As a result, the update
doesn't happen and the property tree is out-of-sync.

2) If an in-progress animation is removed on the main thread, the
previously-animated layer may no longer own a property tree node.
However, right after commit, the animation is still in a "Running"
state on the compositor thread (so that the active tree continues to
be affected until tree activation). As a result, LayerImpl will
update a tree node that it doesn't actually own, so this node will
end up with the wrong value.

To fix these problems, LayerImpl now checks for any animation rather
than only those that aren't finished (to handle the possibility that
the animation might have finished during the commit), and also now
checks that it owns a property tree node before updating this node
(to handle the possibility that it no longer owns a node).

All layout tests now pass with property tree verification enabled.

BUG=509679
CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel

Review URL: https://codereview.chromium.org/1231903005

Cr-Commit-Position: refs/heads/master@{#338537}
cc/animation/animation_host.cc
cc/animation/animation_host.h
cc/layers/layer_impl.cc
cc/layers/layer_impl.h
cc/trees/layer_tree_host_unittest_animation.cc
cc/trees/layer_tree_host_unittest_animation_timelines.cc
cc/trees/layer_tree_host_unittest_picture.cc
cc/trees/layer_tree_impl.cc
cc/trees/layer_tree_impl.h