Index: cc/trees/thread_proxy.cc |
diff --git a/cc/trees/thread_proxy.cc b/cc/trees/thread_proxy.cc |
index 5ac7a797751f6e58a3ef3a81c469a0f664af76a7..a3928cf309c0cab60d29744a61e4cfa4780d8286 100644 |
--- a/cc/trees/thread_proxy.cc |
+++ b/cc/trees/thread_proxy.cc |
@@ -453,11 +453,6 @@ void ThreadProxy::SetNeedsBeginImplFrame(bool enable) { |
void ThreadProxy::BeginImplFrame(const BeginFrameArgs& args) { |
TRACE_EVENT0("cc", "ThreadProxy::BeginImplFrame"); |
DCHECK(IsImplThread()); |
- |
- // Sample the frame time now. This time will be used for updating animations |
- // when we draw. |
- impl().layer_tree_host_impl->CurrentFrameTimeTicks(); |
- |
impl().scheduler->BeginImplFrame(args); |
} |
@@ -1053,6 +1048,21 @@ void ThreadProxy::BeginMainFrameAbortedOnImplThread(bool did_handle) { |
impl().scheduler->BeginMainFrameAborted(did_handle); |
} |
+void ThreadProxy::ScheduledActionAnimate() { |
+ TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionAnimate"); |
+ DCHECK(IsImplThread()); |
+ |
+ if (!impl().animations_frozen_until_next_draw) { |
+ impl().animation_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(); |
ajuma
2014/03/21 15:05:14
We should move this down by a line so that it happ
|
+ impl().layer_tree_host_impl->Animate(impl().animation_time); |
+} |
+ |
void ThreadProxy::ScheduledActionCommit() { |
TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionCommit"); |
DCHECK(IsImplThread()); |
@@ -1065,9 +1075,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; |
@@ -1145,18 +1154,6 @@ 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 |
// request completes, and we signal completion here. If CanDraw() is false, we |
@@ -1209,7 +1206,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); |
} |