Index: cc/trees/thread_proxy.cc |
diff --git a/cc/trees/thread_proxy.cc b/cc/trees/thread_proxy.cc |
index e84937b41915d5f81f7f8cf2d9fffe14e6e130eb..b44f4de5a22a74fa438e5ffbf76abae3723a0be1 100644 |
--- a/cc/trees/thread_proxy.cc |
+++ b/cc/trees/thread_proxy.cc |
@@ -583,6 +583,12 @@ void ThreadProxy::SetNeedsRedrawOnImplThread() { |
impl().scheduler->SetNeedsRedraw(); |
} |
+void ThreadProxy::SetNeedsAnimateOnImplThread() { |
+ TRACE_EVENT0("cc", "ThreadProxy::SetNeedsAnimateOnImplThread"); |
+ DCHECK(IsImplThread()); |
+ impl().scheduler->SetNeedsAnimate(); |
+} |
+ |
void ThreadProxy::SetNeedsManageTilesOnImplThread() { |
DCHECK(IsImplThread()); |
impl().scheduler->SetNeedsManageTiles(); |
@@ -1057,6 +1063,19 @@ void ThreadProxy::BeginMainFrameAbortedOnImplThread(bool did_handle) { |
impl().scheduler->BeginMainFrameAborted(did_handle); |
} |
+void ThreadProxy::ScheduledActionAnimate() { |
+ TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionAnimate"); |
+ DCHECK(IsImplThread()); |
+ |
+ UpdateBackgroundAnimateTicking(); |
+ |
+ if (!impl().animations_frozen_until_next_draw) { |
+ impl().animation_time = |
+ impl().layer_tree_host_impl->CurrentFrameTimeTicks(); |
+ } |
+ impl().layer_tree_host_impl->Animate(impl().animation_time); |
+} |
+ |
void ThreadProxy::ScheduledActionCommit() { |
TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionCommit"); |
DCHECK(IsImplThread()); |
@@ -1069,9 +1088,8 @@ void ThreadProxy::ScheduledActionCommit() { |
impl().current_resource_update_controller.reset(); |
if (impl().animations_frozen_until_next_draw) { |
- impl().animation_freeze_time = |
- std::max(impl().animation_freeze_time, |
- blocked_main().last_monotonic_frame_begin_time); |
+ impl().animation_time = std::max( |
+ impl().animation_time, blocked_main().last_monotonic_frame_begin_time); |
} |
blocked_main().main_thread_inside_commit = true; |
@@ -1146,17 +1164,8 @@ DrawSwapReadbackResult ThreadProxy::DrawSwapReadbackInternal( |
base::TimeDelta draw_duration_estimate = DrawDurationEstimate(); |
base::AutoReset<bool> mark_inside(&impl().inside_draw, true); |
- // Advance our animations. |
- base::TimeTicks monotonic_time; |
- if (impl().animations_frozen_until_next_draw) |
- monotonic_time = impl().animation_freeze_time; |
- else |
- monotonic_time = impl().layer_tree_host_impl->CurrentFrameTimeTicks(); |
- |
- // TODO(enne): This should probably happen post-animate. |
if (impl().layer_tree_host_impl->pending_tree()) |
impl().layer_tree_host_impl->pending_tree()->UpdateDrawProperties(); |
- impl().layer_tree_host_impl->Animate(monotonic_time); |
// 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 |
@@ -1210,7 +1219,6 @@ DrawSwapReadbackResult ThreadProxy::DrawSwapReadbackInternal( |
// checkerboarding will be displayed when we force a draw. To avoid this, |
// we freeze animations until we successfully draw. |
impl().animations_frozen_until_next_draw = true; |
- impl().animation_freeze_time = monotonic_time; |
} else { |
DCHECK_NE(DrawSwapReadbackResult::DRAW_SUCCESS, result.draw_result); |
} |