Index: cc/trees/layer_tree_host_impl.cc |
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc |
index d751441ed558158f30e9cd45b7a04a957e635901..833938986fa5d439b5540b5e10a9751a3a45a4af 100644 |
--- a/cc/trees/layer_tree_host_impl.cc |
+++ b/cc/trees/layer_tree_host_impl.cc |
@@ -112,6 +112,8 @@ class LayerTreeHostImplTimeSourceAdapter : public TimeSourceClient { |
layer_tree_host_impl_->ActivatePendingTreeIfNeeded(); |
layer_tree_host_impl_->Animate(base::TimeTicks::Now(), base::Time::Now()); |
+ layer_tree_host_impl_->UpdateBackgroundAnimateTicking(); |
+ layer_tree_host_impl_->UpdateAnimationState(); |
layer_tree_host_impl_->BeginNextFrame(); |
} |
@@ -675,7 +677,11 @@ bool LayerTreeHostImpl::CalculateRenderPasses(FrameData* frame) { |
return draw_frame; |
} |
-void LayerTreeHostImpl::SetBackgroundTickingEnabled(bool enabled) { |
+void LayerTreeHostImpl::UpdateBackgroundAnimateTicking() { |
+ bool able_to_draw = visible_ && CanDraw(); |
+ bool enabled = !able_to_draw && |
+ !animation_registrar_->active_animation_controllers().empty(); |
+ |
// Lazily create the time_source adapter so that we can vary the interval for |
// testing. |
if (!time_source_client_adapter_) { |
@@ -1035,7 +1041,6 @@ void LayerTreeHostImpl::DrawLayers(FrameData* frame, |
DidDrawDamagedArea(); |
} |
active_tree_->root_layer()->ResetAllChangeTrackingForSubtree(); |
- UpdateAnimationState(); |
} |
void LayerTreeHostImpl::DidDrawAllLayers(const FrameData& frame) { |
@@ -1240,10 +1245,6 @@ void LayerTreeHostImpl::SetVisible(bool visible) { |
return; |
renderer_->SetVisible(visible); |
- |
- SetBackgroundTickingEnabled( |
- !visible_ && |
- !animation_registrar_->active_animation_controllers().empty()); |
} |
bool LayerTreeHostImpl::InitializeRenderer( |
@@ -1815,9 +1816,6 @@ void LayerTreeHostImpl::AnimateLayers(base::TimeTicks monotonic_time, |
(*iter).second->Animate(monotonic_seconds); |
client_->SetNeedsRedrawOnImplThread(); |
- SetBackgroundTickingEnabled( |
- !visible_ && |
- !animation_registrar_->active_animation_controllers().empty()); |
} |
void LayerTreeHostImpl::UpdateAnimationState() { |