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

Unified Diff: cc/trees/thread_proxy.cc

Issue 595973002: Moving background animation ticking from LayerTreeHostImpl into the Scheduler. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@scheduler-timesource-refactor
Patch Set: ALL TESTS PASS LOCALLY!!!! 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
« cc/trees/single_thread_proxy.cc ('K') | « cc/trees/thread_proxy.h ('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 14e218194e026d57cf300dd7a41a58ac21cb5b8b..373eec01b97d5f740414cc7fd71c9f7e9b0739de 100644
--- a/cc/trees/thread_proxy.cc
+++ b/cc/trees/thread_proxy.cc
@@ -176,18 +176,9 @@ void ThreadProxy::SetVisibleOnImplThread(CompletionEvent* completion,
TRACE_EVENT0("cc", "ThreadProxy::SetVisibleOnImplThread");
impl().layer_tree_host_impl->SetVisible(visible);
impl().scheduler->SetVisible(visible);
- UpdateBackgroundAnimateTicking();
completion->Signal();
}
-void ThreadProxy::UpdateBackgroundAnimateTicking() {
- bool should_background_tick =
- !impl().scheduler->WillDrawIfNeeded() &&
- impl().layer_tree_host_impl->active_tree()->root_layer();
- impl().layer_tree_host_impl->UpdateBackgroundAnimateTicking(
- should_background_tick);
-}
-
void ThreadProxy::DidLoseOutputSurface() {
TRACE_EVENT0("cc", "ThreadProxy::DidLoseOutputSurface");
DCHECK(IsMainThread());
@@ -358,7 +349,6 @@ void ThreadProxy::OnCanDrawStateChanged(bool can_draw) {
"cc", "ThreadProxy::OnCanDrawStateChanged", "can_draw", can_draw);
DCHECK(IsImplThread());
impl().scheduler->SetCanDraw(can_draw);
- UpdateBackgroundAnimateTicking();
}
void ThreadProxy::NotifyReadyToActivate() {
@@ -933,9 +923,22 @@ void ThreadProxy::ScheduledActionAnimate() {
TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionAnimate");
DCHECK(IsImplThread());
+ // Don't animate if there is no root layer.
+ // TODO(mithro): Both Animate and UpdateAnimationState already have a
+ // "!active_tree_->root_layer()" check?
+ if (!impl().layer_tree_host_impl->active_tree()->root_layer()) {
+ return;
+ }
+
impl().animation_time =
impl().layer_tree_host_impl->CurrentBeginFrameArgs().frame_time;
impl().layer_tree_host_impl->Animate(impl().animation_time);
+
+ // If animations are not visible, update the state now as
+ // ScheduledActionDrawAndSwapIfPossible will never be called.
+ if (!impl().layer_tree_host_impl->AnimationsAreVisible()) {
brianderson 2014/11/04 18:54:38 Should we make this part of the aborted draw and s
mithro-old 2014/11/04 22:16:50 As far as I can tell, ScheduledActionDrawAndSwapIf
brianderson 2014/11/04 23:32:19 Sure, can you open a bug?
mithro-old 2014/11/05 00:02:36 Will do when this code lands (incase this changes)
+ impl().layer_tree_host_impl->UpdateAnimationState(true);
+ }
}
void ThreadProxy::ScheduledActionCommit() {
@@ -979,8 +982,6 @@ void ThreadProxy::ScheduledActionCommit() {
SetInputThrottledUntilCommitOnImplThread(false);
- UpdateBackgroundAnimateTicking();
-
impl().next_frame_is_newly_committed_frame = true;
impl().timing_history.DidCommit();
@@ -1358,8 +1359,6 @@ void ThreadProxy::DidActivateSyncTree() {
impl().completion_event_for_commit_held_on_tree_activation = NULL;
}
- UpdateBackgroundAnimateTicking();
-
impl().timing_history.DidActivateSyncTree();
}
« cc/trees/single_thread_proxy.cc ('K') | « cc/trees/thread_proxy.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698