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

Unified Diff: cc/trees/layer_tree_host_impl.cc

Issue 23593003: cc: Avoid updating animations in the background without an active tree (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: nits Created 7 years, 4 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/test/layer_tree_test.cc ('k') | cc/trees/layer_tree_host_unittest_animation.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 5546ea33d36ce5773120089d2538164aaec607e9..870b65d89ba7b123085028c34359d4afbf122131 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -128,6 +128,8 @@ class LayerTreeHostImplTimeSourceAdapter : public TimeSourceClient {
time_source_->SetActive(active);
}
+ bool Active() const { return time_source_->Active(); }
+
private:
LayerTreeHostImplTimeSourceAdapter(
LayerTreeHostImpl* layer_tree_host_impl,
@@ -256,6 +258,8 @@ void LayerTreeHostImpl::CommitComplete() {
ManageTiles();
} else {
active_tree_->set_needs_update_draw_properties();
+ if (time_source_client_adapter_ && time_source_client_adapter_->Active())
+ DCHECK(active_tree_->root_layer());
}
client_->SendManagedMemoryStats();
@@ -825,6 +829,8 @@ void LayerTreeHostImpl::MainThreadHasStoppedFlinging() {
void LayerTreeHostImpl::UpdateBackgroundAnimateTicking(
bool should_background_tick) {
DCHECK(proxy_->IsImplThread());
+ if (should_background_tick)
+ DCHECK(active_tree_->root_layer());
bool enabled = should_background_tick &&
!animation_registrar_->active_animation_controllers().empty();
@@ -1503,6 +1509,9 @@ void LayerTreeHostImpl::ActivatePendingTree() {
client_->DidActivatePendingTree();
if (!tree_activation_callback_.is_null())
tree_activation_callback_.Run();
+
+ if (time_source_client_adapter_ && time_source_client_adapter_->Active())
+ DCHECK(active_tree_->root_layer());
}
void LayerTreeHostImpl::SetVisible(bool visible) {
« no previous file with comments | « cc/test/layer_tree_test.cc ('k') | cc/trees/layer_tree_host_unittest_animation.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698