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

Unified Diff: cc/trees/single_thread_proxy.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: Add DCHECKs, fix SingleThreadProxy 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/trees/single_thread_proxy.h ('k') | cc/trees/thread_proxy.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/single_thread_proxy.cc
diff --git a/cc/trees/single_thread_proxy.cc b/cc/trees/single_thread_proxy.cc
index cb42f0853b168561d3efe98c76ca8ba24596b1df..e418740e3d9cd260455f4726d08f4265dc49d8f0 100644
--- a/cc/trees/single_thread_proxy.cc
+++ b/cc/trees/single_thread_proxy.cc
@@ -100,7 +100,7 @@ void SingleThreadProxy::SetVisible(bool visible) {
layer_tree_host_impl_->SetVisible(visible);
// Changing visibility could change ShouldComposite().
- layer_tree_host_impl_->UpdateBackgroundAnimateTicking(!ShouldComposite());
+ UpdateBackgroundAnimateTicking();
}
void SingleThreadProxy::CreateAndInitializeOutputSurface() {
@@ -265,7 +265,7 @@ void SingleThreadProxy::Stop() {
void SingleThreadProxy::OnCanDrawStateChanged(bool can_draw) {
DCHECK(Proxy::IsImplThread());
- layer_tree_host_impl_->UpdateBackgroundAnimateTicking(!ShouldComposite());
+ UpdateBackgroundAnimateTicking();
}
void SingleThreadProxy::NotifyReadyToActivate() {
@@ -427,6 +427,13 @@ bool SingleThreadProxy::ShouldComposite() const {
layer_tree_host_impl_->CanDraw();
}
+void SingleThreadProxy::UpdateBackgroundAnimateTicking() {
+ DCHECK(Proxy::IsImplThread());
+ layer_tree_host_impl_->UpdateBackgroundAnimateTicking(
+ !ShouldComposite() &&
+ layer_tree_host_impl_->active_tree()->root_layer());
+}
+
bool SingleThreadProxy::DoComposite(
scoped_refptr<cc::ContextProvider> offscreen_context_provider,
base::TimeTicks frame_begin_time,
@@ -450,14 +457,14 @@ bool SingleThreadProxy::DoComposite(
// DrawLayers() depends on the result of PrepareToDraw(), it is guarded on
// CanDraw() as well.
if (!ShouldComposite() || (for_readback && !can_do_readback)) {
- layer_tree_host_impl_->UpdateBackgroundAnimateTicking(true);
+ UpdateBackgroundAnimateTicking();
brianderson 2013/08/29 01:03:09 For the same reasons as in ThreadProxy, I do not a
return false;
}
layer_tree_host_impl_->Animate(
layer_tree_host_impl_->CurrentFrameTimeTicks(),
layer_tree_host_impl_->CurrentFrameTime());
- layer_tree_host_impl_->UpdateBackgroundAnimateTicking(false);
+ UpdateBackgroundAnimateTicking();
layer_tree_host_impl_->PrepareToDraw(frame, device_viewport_damage_rect);
layer_tree_host_impl_->DrawLayers(frame, frame_begin_time);
« no previous file with comments | « cc/trees/single_thread_proxy.h ('k') | cc/trees/thread_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698