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

Unified Diff: cc/trees/thread_proxy.cc

Issue 206793003: cc: Split animating and drawing into separate actions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleanup. Created 6 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/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 8a1547c32749256fe61b6e0e528aa4a73706985e..a68581d5792ca0fcb293e25e7ac22012d8ff478a 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->UpdateCurrentFrameTime();
-
impl().scheduler->BeginImplFrame(args);
}
@@ -589,6 +584,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();
@@ -1053,6 +1054,20 @@ void ThreadProxy::BeginMainFrameAbortedOnImplThread(bool did_handle) {
impl().scheduler->BeginMainFrameAborted(did_handle);
}
+void ThreadProxy::ScheduledActionAnimate() {
+ TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionAnimate");
+ DCHECK(IsImplThread());
+
+ impl().layer_tree_host_impl->UpdateCurrentFrameTime();
brianderson 2014/04/01 16:05:11 I think we should keep the UpdateCurrentFrameTime(
Sami 2014/04/17 15:16:33 Yes, agreed. I've changed this back the way it was
+ 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());
@@ -1065,9 +1080,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 +1159,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 +1211,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);
}
@@ -1340,6 +1341,8 @@ DrawSwapReadbackResult ThreadProxy::ScheduledActionDrawAndSwapIfPossible() {
// handle DRAW_ABORTED_CANT_DRAW. Moreover, the scheduler should
// never generate this call when it can't draw.
DCHECK(impl().layer_tree_host_impl->CanDraw());
+ if (impl().layer_tree_host_impl->pending_tree())
+ impl().layer_tree_host_impl->pending_tree()->UpdateDrawProperties();
brianderson 2014/04/01 16:05:11 Why was this moved here?
Sami 2014/04/17 15:16:33 Hmm, I was trying to keep it in DrawSwapReadbackIn
bool forced_draw = false;
bool swap_requested = true;
« cc/trees/layer_tree_host_impl.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