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

Unified Diff: cc/trees/single_thread_proxy.cc

Issue 713783002: Revert of Moving background animation ticking from LayerTreeHostImpl into the Scheduler. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@scheduler-timesource-refactor
Patch Set: Created 6 years, 1 month 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 94a6f2851c129f191776b57a31236a3970847bba..439304aa3179cf10f4ba91c255346ecdc43acb14 100644
--- a/cc/trees/single_thread_proxy.cc
+++ b/cc/trees/single_thread_proxy.cc
@@ -101,6 +101,7 @@
if (scheduler_on_impl_thread_)
scheduler_on_impl_thread_->SetVisible(layer_tree_host_impl_->visible());
// Changing visibility could change ShouldComposite().
+ UpdateBackgroundAnimateTicking();
}
void SingleThreadProxy::RequestNewOutputSurface() {
@@ -160,24 +161,6 @@
SetNeedsCommit();
}
-void SingleThreadProxy::DoAnimate() {
- // Don't animate if there is no root layer.
- // TODO(mithro): Both Animate and UpdateAnimationState already have a
- // "!active_tree_->root_layer()" check?
- if (!layer_tree_host_impl_->active_tree()->root_layer()) {
- return;
- }
-
- layer_tree_host_impl_->Animate(
- layer_tree_host_impl_->CurrentBeginFrameArgs().frame_time);
-
- // If animations are not visible, update the animation state now as it
- // won't happen in DoComposite.
- if (!layer_tree_host_impl_->AnimationsAreVisible()) {
- layer_tree_host_impl_->UpdateAnimationState(true);
- }
-}
-
void SingleThreadProxy::DoCommit() {
TRACE_EVENT0("cc", "SingleThreadProxy::DoCommit");
DCHECK(Proxy::IsMainThread());
@@ -218,6 +201,8 @@
layer_tree_host_->FinishCommitOnImplThread(layer_tree_host_impl_.get());
layer_tree_host_impl_->CommitComplete();
+
+ UpdateBackgroundAnimateTicking();
#if DCHECK_IS_ON
// In the single-threaded case, the scale and scroll deltas should never be
@@ -337,6 +322,7 @@
TRACE_EVENT1(
"cc", "SingleThreadProxy::OnCanDrawStateChanged", "can_draw", can_draw);
DCHECK(Proxy::IsImplThread());
+ UpdateBackgroundAnimateTicking();
if (scheduler_on_impl_thread_)
scheduler_on_impl_thread_->SetCanDraw(can_draw);
}
@@ -355,9 +341,7 @@
}
void SingleThreadProxy::SetNeedsAnimateOnImplThread() {
- client_->ScheduleComposite();
- if (scheduler_on_impl_thread_)
- scheduler_on_impl_thread_->SetNeedsAnimate();
+ SetNeedsRedrawOnImplThread();
}
void SingleThreadProxy::SetNeedsManageTilesOnImplThread() {
@@ -430,6 +414,7 @@
weak_factory_.GetWeakPtr()));
}
+ UpdateBackgroundAnimateTicking();
timing_history_.DidActivateSyncTree();
}
@@ -507,8 +492,6 @@
layer_tree_host_impl_->SynchronouslyInitializeAllTiles();
}
- DoAnimate();
-
LayerTreeHostImpl::FrameData frame;
DoComposite(frame_begin_time, &frame);
@@ -548,6 +531,12 @@
DCHECK(Proxy::IsImplThread());
return layer_tree_host_impl_->visible() &&
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());
}
void SingleThreadProxy::ScheduleRequestNewOutputSurface() {
@@ -577,10 +566,15 @@
// DrawLayers() depends on the result of PrepareToDraw(), it is guarded on
// CanDraw() as well.
if (!ShouldComposite()) {
+ UpdateBackgroundAnimateTicking();
return DRAW_ABORTED_CANT_DRAW;
}
timing_history_.DidStartDrawing();
+
+ layer_tree_host_impl_->Animate(
+ layer_tree_host_impl_->CurrentBeginFrameArgs().frame_time);
+ UpdateBackgroundAnimateTicking();
draw_result = layer_tree_host_impl_->PrepareToDraw(frame);
draw_frame = draw_result == DRAW_SUCCESS;
@@ -742,8 +736,8 @@
void SingleThreadProxy::ScheduledActionAnimate() {
TRACE_EVENT0("cc", "ScheduledActionAnimate");
- DebugScopedSetImplThread impl(this);
- DoAnimate();
+ layer_tree_host_impl_->Animate(
+ layer_tree_host_impl_->CurrentBeginFrameArgs().frame_time);
}
void SingleThreadProxy::ScheduledActionUpdateVisibleTiles() {
« 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