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

Unified Diff: cc/trees/single_thread_proxy.cc

Issue 13613003: cc: Make animations tick regardless of drawing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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
Index: cc/trees/single_thread_proxy.cc
diff --git a/cc/trees/single_thread_proxy.cc b/cc/trees/single_thread_proxy.cc
index 84c24e056246016c950c3479e58a3d781204ca01..6d60808dbdf894b08e73ff72f6898713271d7783 100644
--- a/cc/trees/single_thread_proxy.cc
+++ b/cc/trees/single_thread_proxy.cc
@@ -259,6 +259,11 @@ void SingleThreadProxy::Stop() {
layer_tree_host_ = NULL;
}
+void SingleThreadProxy::OnCanDrawStateChanged(bool can_draw) {
+ DCHECK(Proxy::IsImplThread());
+ layer_tree_host_impl_->UpdateBackgroundAnimateTicking();
+}
+
void SingleThreadProxy::SetNeedsRedrawOnImplThread() {
layer_tree_host_->ScheduleComposite();
}
@@ -395,17 +400,22 @@ bool SingleThreadProxy::DoComposite(
layer_tree_host_impl_->resource_provider()->
set_offscreen_context_provider(offscreen_context_provider);
- if (!layer_tree_host_impl_->visible())
+ if (!layer_tree_host_impl_->visible()) {
+ layer_tree_host_impl_->UpdateBackgroundAnimateTicking();
return false;
+ }
- layer_tree_host_impl_->Animate(base::TimeTicks::Now(), base::Time::Now());
-
- // We guard prepareToDraw() with canDraw() because it always returns a valid
+ // We guard PrepareToDraw() with CanDraw() because it always returns a valid
// frame, so can only be used when such a frame is possible. Since
- // drawLayers() depends on the result of prepareToDraw(), it is guarded on
- // canDraw() as well.
- if (!layer_tree_host_impl_->CanDraw())
+ // DrawLayers() depends on the result of PrepareToDraw(), it is guarded on
+ // CanDraw() as well.
+ if (!layer_tree_host_impl_->CanDraw()) {
+ layer_tree_host_impl_->UpdateBackgroundAnimateTicking();
return false;
+ }
+
+ layer_tree_host_impl_->Animate(base::TimeTicks::Now(), base::Time::Now());
+ layer_tree_host_impl_->UpdateBackgroundAnimateTicking();
LayerTreeHostImpl::FrameData frame;
layer_tree_host_impl_->PrepareToDraw(&frame);
@@ -413,6 +423,8 @@ bool SingleThreadProxy::DoComposite(
layer_tree_host_impl_->DidDrawAllLayers(frame);
output_surface_lost_ = layer_tree_host_impl_->IsContextLost();
+ layer_tree_host_impl_->UpdateAnimationState();
+
layer_tree_host_impl_->BeginNextFrame();
}

Powered by Google App Engine
This is Rietveld 408576698