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

Unified Diff: cc/trees/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
« cc/trees/layer_tree_host_impl.cc ('K') | « cc/trees/single_thread_proxy.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/thread_proxy.cc
diff --git a/cc/trees/thread_proxy.cc b/cc/trees/thread_proxy.cc
index a09850a5ece8968e1f7868140f1c74fe0202676a..0bc73cdab6bf36684e16491a21639b5ac8126a4c 100644
--- a/cc/trees/thread_proxy.cc
+++ b/cc/trees/thread_proxy.cc
@@ -348,6 +348,7 @@ void ThreadProxy::OnCanDrawStateChanged(bool can_draw) {
TRACE_EVENT1(
"cc", "ThreadProxy::OnCanDrawStateChanged", "can_draw", can_draw);
scheduler_on_impl_thread_->SetCanDraw(can_draw);
+ layer_tree_host_impl_->UpdateBackgroundAnimateTicking();
}
void ThreadProxy::OnHasPendingTreeStateChanged(bool has_pending_tree) {
@@ -811,6 +812,8 @@ void ThreadProxy::ScheduledActionCommit() {
layer_tree_host_->FinishCommitOnImplThread(layer_tree_host_impl_.get());
layer_tree_host_impl_->CommitComplete();
+ layer_tree_host_impl_->UpdateBackgroundAnimateTicking();
+
next_frame_is_newly_committed_frame_on_impl_thread_ = true;
if (layer_tree_host_->settings().impl_side_painting &&
@@ -876,30 +879,42 @@ ThreadProxy::ScheduledActionDrawAndSwapInternal(bool forced_draw) {
layer_tree_host_impl_->ActivatePendingTreeIfNeeded();
layer_tree_host_impl_->Animate(monotonic_time, wall_clock_time);
+ layer_tree_host_impl_->UpdateBackgroundAnimateTicking();
// This method is called on a forced draw, regardless of whether we are able
// to produce a frame, as the calling site on main thread is blocked until its
- // request completes, and we signal completion here. If canDraw() is false, we
+ // request completes, and we signal completion here. If CanDraw() is false, we
// will indicate success=false to the caller, but we must still signal
// completion to avoid deadlock.
- // 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.
+ // DrawLayers() depends on the result of PrepareToDraw(), it is guarded on
+ // CanDraw() as well.
LayerTreeHostImpl::FrameData frame;
- bool draw_frame =
- layer_tree_host_impl_->CanDraw() &&
- (layer_tree_host_impl_->PrepareToDraw(&frame) || forced_draw);
+ bool draw_frame = false;
+ bool start_ready_animations = true;
+
+ if (layer_tree_host_impl_->CanDraw()) {
+ // Do not start animations if we skip drawing the frame to avoid
+ // checkerboarding.
+ if (layer_tree_host_impl_->PrepareToDraw(&frame) || forced_draw)
+ draw_frame = true;
+ else
+ start_ready_animations = false;
+ }
+
if (draw_frame) {
layer_tree_host_impl_->DrawLayers(
&frame,
scheduler_on_impl_thread_->LastVSyncTime());
- result.did_draw= true;
+ result.did_draw = true;
}
layer_tree_host_impl_->DidDrawAllLayers(frame);
+ layer_tree_host_impl_->UpdateAnimationState(start_ready_animations);
+
// Check for tree activation.
if (completion_event_for_commit_held_on_tree_activation_ &&
!layer_tree_host_impl_->pending_tree()) {
« cc/trees/layer_tree_host_impl.cc ('K') | « cc/trees/single_thread_proxy.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698