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(); |