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

Issue 13613003: cc: Make animations tick regardless of drawing. (Closed)

Created:
7 years, 8 months ago by danakj
Modified:
7 years, 8 months ago
Reviewers:
ajuma, enne (OOO)
CC:
chromium-reviews, cc-bugs_chromium.org, Ian Vollick, piman, backer
Visibility:
Public.

Description

cc: Make animations tick regardless of drawing. The compositor should tick and finish animations even if it is not drawing anything. It can not draw for various reasons: 1) The tab is backgrounded. 2) CanDraw() is false for any of its reasons. 3) PrepareToDraw() fails due to checkerboarding. 4) There is no damage on the screen to draw. Currently the problems are: - When backgrounded, the animations are ticked but their states are not updated. - When CanDraw() is false, we don't draw, and animations just stop ticking. - If we stop drawing when we damage the screen, we tick animations, but don't update animation state since this happens in DrawLayers(). To solve these problems, I've moved the animation control more explicitly out of LayerTreeHostImpl. The proxy already calls Animate(). Now it will also call UpdateAnimationState(). It always does this after calling Animate() regardless if drawing or not. Secondly, the missing UpdateAnimationState() call is added to the OnTimerTick for background animation ticking. We enable background ticking only when we change visibility, currently. But when CanDraw() is false, we don't draw and thus don't tick animations. So instead we add to LayerTreeHostImpl a UpdateBackgroundAnimateTicking() method. We call this always after calling Animate() since that can remove animations - it's something Animate() used to do. And we also call this: a) After a commit - this could add new animations, or change visibility. b) After changing CanDraw()'s state. However, when PrepareToDraw() is false, we do not want to start new animations so we let animations finish without starting new ones. This is verified by the LayerTreeHostAnimationTestCheckerboardDoesntStartAnimations test. This is covered by adding single-thread mode to all the animation unit tests (except those that call SetNeedsAnimate() which is not legal in single thread mode). Also by new tests: LayerTreeHostAnimationTestRunAnimationWhenNotCanDraw.RunSingleThread LayerTreeHostAnimationTestRunAnimationWhenNotCanDraw.RunMultiThread LayerTreeHostAnimationTestRunAnimationWhenNotVisible.RunSingleThread LayerTreeHostAnimationTestRunAnimationWhenNotVisible.RunMultiThread LayerTreeHostAnimationTestCheckerboardDoesntStartAnimations.RunMultiThread Added scheduler tests: SchedulerStateMachineTest.ReportIfNotDrawing SchedulerStateMachineTest.ReportIfNotDrawingFromAcquiredTextures R=ajuma@chromium.org BUG=222915 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=192671

Patch Set 1 #

Total comments: 5

Patch Set 2 : preparetodraw #

Patch Set 3 : #

Total comments: 2

Patch Set 4 : parameter #

Total comments: 2

Patch Set 5 : #

Patch Set 6 : helper functions #

Patch Set 7 : helper-in-scheduler #

Patch Set 8 : Add scheduler tests #

Patch Set 9 : Drop extra statemachine function #

Unified diffs Side-by-side diffs Delta from patch set Stats (+463 lines, -125 lines) Patch
M cc/animation/layer_animation_controller.h View 1 1 chunk +3 lines, -1 line 0 comments Download
M cc/animation/layer_animation_controller.cc View 1 1 chunk +10 lines, -4 lines 0 comments Download
M cc/animation/layer_animation_controller_unittest.cc View 1 30 chunks +63 lines, -63 lines 0 comments Download
M cc/scheduler/scheduler.h View 1 2 3 4 5 6 7 1 chunk +2 lines, -0 lines 0 comments Download
M cc/scheduler/scheduler.cc View 1 2 3 4 5 6 7 8 1 chunk +4 lines, -0 lines 0 comments Download
M cc/scheduler/scheduler_state_machine.h View 1 2 3 4 5 6 7 8 1 chunk +4 lines, -1 line 0 comments Download
M cc/scheduler/scheduler_state_machine_unittest.cc View 1 2 3 4 5 6 7 8 1 chunk +56 lines, -0 lines 0 comments Download
M cc/test/layer_tree_test.h View 1 2 chunks +3 lines, -3 lines 0 comments Download
M cc/test/layer_tree_test.cc View 1 5 chunks +20 lines, -10 lines 0 comments Download
M cc/trees/layer_tree_host.cc View 1 1 chunk +2 lines, -1 line 0 comments Download
M cc/trees/layer_tree_host_impl.h View 1 2 3 3 chunks +2 lines, -2 lines 0 comments Download
M cc/trees/layer_tree_host_impl.cc View 1 2 3 6 chunks +10 lines, -11 lines 0 comments Download
M cc/trees/layer_tree_host_unittest_animation.cc View 1 2 15 chunks +234 lines, -12 lines 0 comments Download
M cc/trees/single_thread_proxy.h View 1 2 3 4 5 2 chunks +3 lines, -1 line 0 comments Download
M cc/trees/single_thread_proxy.cc View 1 2 3 4 5 4 chunks +22 lines, -8 lines 0 comments Download
M cc/trees/thread_proxy.cc View 1 2 3 4 5 6 7 3 chunks +25 lines, -8 lines 0 comments Download

Messages

Total messages: 21 (0 generated)
danakj
7 years, 8 months ago (2013-04-04 03:46:12 UTC) #1
danakj
There's a bunch of common boilerplate in the tests for adding/removing animations, which I can ...
7 years, 8 months ago (2013-04-04 03:46:42 UTC) #2
danakj
This is a pre-req for https://codereview.chromium.org/12662021/
7 years, 8 months ago (2013-04-04 03:47:40 UTC) #3
ajuma
I like the general direction here, but I'd like to make sure we still avoid ...
7 years, 8 months ago (2013-04-04 15:28:47 UTC) #4
danakj
PTAL I've reverted the LayerAnimationController changes as we discussed, and stuck a TODO(ajuma) in the ...
7 years, 8 months ago (2013-04-04 18:28:25 UTC) #5
danakj
Confirmed this still makes the unit tests work for https://codereview.chromium.org/12662021/ as well.
7 years, 8 months ago (2013-04-04 19:02:18 UTC) #6
ajuma
LGTM. Thanks for the tests!
7 years, 8 months ago (2013-04-04 19:07:04 UTC) #7
enne (OOO)
I absolutely agree that animations should tick if there's no damage, as a further animation ...
7 years, 8 months ago (2013-04-04 23:36:41 UTC) #8
ajuma
On 2013/04/04 23:36:41, enne wrote: > I absolutely agree that animations should tick if there's ...
7 years, 8 months ago (2013-04-05 00:00:53 UTC) #9
danakj
On 2013/04/05 00:00:53, ajuma wrote: > On 2013/04/04 23:36:41, enne wrote: > > I absolutely ...
7 years, 8 months ago (2013-04-05 01:17:19 UTC) #10
enne (OOO)
Ok. I think I am convinced by danakj's offline comments that we were already doing ...
7 years, 8 months ago (2013-04-05 16:01:12 UTC) #11
danakj
https://codereview.chromium.org/13613003/diff/10002/cc/trees/layer_tree_host_impl.cc File cc/trees/layer_tree_host_impl.cc (right): https://codereview.chromium.org/13613003/diff/10002/cc/trees/layer_tree_host_impl.cc#newcode682 cc/trees/layer_tree_host_impl.cc:682: bool able_to_draw = visible_ && CanDraw(); On 2013/04/05 16:01:12, ...
7 years, 8 months ago (2013-04-05 16:38:58 UTC) #12
enne (OOO)
https://codereview.chromium.org/13613003/diff/21005/cc/trees/thread_proxy.cc File cc/trees/thread_proxy.cc (right): https://codereview.chromium.org/13613003/diff/21005/cc/trees/thread_proxy.cc#newcode352 cc/trees/thread_proxy.cc:352: !layer_tree_host_impl_->visible() || !can_draw); I think this is halfway to ...
7 years, 8 months ago (2013-04-05 17:06:53 UTC) #13
danakj
https://codereview.chromium.org/13613003/diff/21005/cc/trees/thread_proxy.cc File cc/trees/thread_proxy.cc (right): https://codereview.chromium.org/13613003/diff/21005/cc/trees/thread_proxy.cc#newcode352 cc/trees/thread_proxy.cc:352: !layer_tree_host_impl_->visible() || !can_draw); On 2013/04/05 17:06:53, enne wrote: > ...
7 years, 8 months ago (2013-04-05 17:54:49 UTC) #14
danakj
On 2013/04/05 17:54:49, danakj wrote: > So it's about more than UpadteAnimateState(). Any time we ...
7 years, 8 months ago (2013-04-05 17:55:37 UTC) #15
danakj
Instead of requiring logic in multiple places, and having the proxy guess if we will ...
7 years, 8 months ago (2013-04-05 18:28:22 UTC) #16
danakj
New tests: SchedulerStateMachineTest.ReportIfNotDrawing SchedulerStateMachineTest.ReportIfNotDrawingFromAcquiredTextures
7 years, 8 months ago (2013-04-05 18:52:12 UTC) #17
enne (OOO)
Thanks, that helps a lot. lgtm if this still looks good to ajuma.
7 years, 8 months ago (2013-04-05 21:08:32 UTC) #18
ajuma
On 2013/04/05 21:08:32, enne wrote: > Thanks, that helps a lot. lgtm if this still ...
7 years, 8 months ago (2013-04-05 21:29:59 UTC) #19
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/danakj@chromium.org/13613003/27005
7 years, 8 months ago (2013-04-05 21:32:34 UTC) #20
commit-bot: I haz the power
7 years, 8 months ago (2013-04-06 00:35:22 UTC) #21
Message was sent while issue was closed.
Change committed as 192671

Powered by Google App Engine
This is Rietveld 408576698