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

Unified Diff: cc/trees/thread_proxy.cc

Issue 12662021: cc: Don't draw and swap if the frame will not change. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add perf test Created 7 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
Index: cc/trees/thread_proxy.cc
diff --git a/cc/trees/thread_proxy.cc b/cc/trees/thread_proxy.cc
index 264c11f098a84248ce2cf74a7482083fddd9f478..79b7179222987e8afc76c5185ce713625fa3734a 100644
--- a/cc/trees/thread_proxy.cc
+++ b/cc/trees/thread_proxy.cc
@@ -886,24 +886,30 @@ ThreadProxy::ScheduledActionDrawAndSwapInternal(bool forced_draw) {
// 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
+ // request completes, and we signal completion here. If CanDraw() is false, we
// will indicate success=false to the caller, but we must still signal
// completion to avoid deadlock.
- // We guard prepareToDraw() with canDraw() because it always returns a valid
+ // We guard PrepareToDraw() with CanDraw() because it always returns a valid
// frame, so can only be used when such a frame is possible. Since
- // drawLayers() depends on the result of prepareToDraw(), it is guarded on
- // canDraw() as well.
+ // DrawLayers() depends on the result of PrepareToDraw(), it is guarded on
+ // CanDraw() as well.
+
+ // If it is a forced draw, make sure we do a draw and swap.
+ gfx::Rect readback_rect;
+ if (readback_request_on_impl_thread_)
+ readback_rect = readback_request_on_impl_thread_->rect;
LayerTreeHostImpl::FrameData frame;
bool draw_frame =
layer_tree_host_impl_->CanDraw() &&
- (layer_tree_host_impl_->PrepareToDraw(&frame) || forced_draw);
+ (layer_tree_host_impl_->PrepareToDraw(&frame, readback_rect) ||
+ forced_draw);
if (draw_frame) {
layer_tree_host_impl_->DrawLayers(
&frame,
scheduler_on_impl_thread_->LastVSyncTime());
- result.did_draw= true;
+ result.did_draw = true;
}
layer_tree_host_impl_->DidDrawAllLayers(frame);
@@ -928,7 +934,7 @@ ThreadProxy::ScheduledActionDrawAndSwapInternal(bool forced_draw) {
readback_request_on_impl_thread_->completion.Signal();
readback_request_on_impl_thread_ = NULL;
} else if (draw_frame) {
- result.did_swap = layer_tree_host_impl_->SwapBuffers();
+ result.did_swap = layer_tree_host_impl_->SwapBuffers(frame);
if (frame.contains_incomplete_tile)
DidSwapUseIncompleteTileOnImplThread();
« cc/trees/layer_tree_host_unittest_damage.cc ('K') | « cc/trees/single_thread_proxy.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698