Index: cc/trees/thread_proxy.cc |
diff --git a/cc/trees/thread_proxy.cc b/cc/trees/thread_proxy.cc |
index 65e8dd27a35de390d404d951d5b701fc56dc5224..37830f601dd0ce1351ecddc55fb0bd6b59b7dd1c 100644 |
--- a/cc/trees/thread_proxy.cc |
+++ b/cc/trees/thread_proxy.cc |
@@ -176,7 +176,16 @@ |
TRACE_EVENT0("cc", "ThreadProxy::SetVisibleOnImplThread"); |
impl().layer_tree_host_impl->SetVisible(visible); |
impl().scheduler->SetVisible(visible); |
+ UpdateBackgroundAnimateTicking(); |
completion->Signal(); |
+} |
+ |
+void ThreadProxy::UpdateBackgroundAnimateTicking() { |
+ bool should_background_tick = |
+ !impl().scheduler->WillDrawIfNeeded() && |
+ impl().layer_tree_host_impl->active_tree()->root_layer(); |
+ impl().layer_tree_host_impl->UpdateBackgroundAnimateTicking( |
+ should_background_tick); |
} |
void ThreadProxy::DidLoseOutputSurface() { |
@@ -349,6 +358,7 @@ |
"cc", "ThreadProxy::OnCanDrawStateChanged", "can_draw", can_draw); |
DCHECK(IsImplThread()); |
impl().scheduler->SetCanDraw(can_draw); |
+ UpdateBackgroundAnimateTicking(); |
} |
void ThreadProxy::NotifyReadyToActivate() { |
@@ -917,22 +927,9 @@ |
TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionAnimate"); |
DCHECK(IsImplThread()); |
- // Don't animate if there is no root layer. |
- // TODO(mithro): Both Animate and UpdateAnimationState already have a |
- // "!active_tree_->root_layer()" check? |
- if (!impl().layer_tree_host_impl->active_tree()->root_layer()) { |
- return; |
- } |
- |
impl().animation_time = |
impl().layer_tree_host_impl->CurrentBeginFrameArgs().frame_time; |
impl().layer_tree_host_impl->Animate(impl().animation_time); |
- |
- // If animations are not visible, update the state now as |
- // ScheduledActionDrawAndSwapIfPossible will never be called. |
- if (!impl().layer_tree_host_impl->AnimationsAreVisible()) { |
- impl().layer_tree_host_impl->UpdateAnimationState(true); |
- } |
} |
void ThreadProxy::ScheduledActionCommit() { |
@@ -975,6 +972,8 @@ |
impl().layer_tree_host_impl->CommitComplete(); |
SetInputThrottledUntilCommitOnImplThread(false); |
+ |
+ UpdateBackgroundAnimateTicking(); |
impl().next_frame_is_newly_committed_frame = true; |
@@ -1353,6 +1352,8 @@ |
impl().completion_event_for_commit_held_on_tree_activation = NULL; |
} |
+ UpdateBackgroundAnimateTicking(); |
+ |
impl().timing_history.DidActivateSyncTree(); |
} |