Index: content/renderer/gpu/compositor_output_surface.cc |
diff --git a/content/renderer/gpu/compositor_output_surface.cc b/content/renderer/gpu/compositor_output_surface.cc |
index dd9d632bad46c66dc8511325b244b8bda55b1356..87b5efd12a6b8900bea4bac0b1af73001915b798 100644 |
--- a/content/renderer/gpu/compositor_output_surface.cc |
+++ b/content/renderer/gpu/compositor_output_surface.cc |
@@ -130,6 +130,9 @@ void CompositorOutputSurface::ShortcutSwapAck( |
} |
void CompositorOutputSurface::SwapBuffers(cc::CompositorFrame* frame) { |
+ if (is_lost_) |
+ return; |
+ |
if (layout_test_mode_ && use_swap_compositor_frame_message_) { |
// This code path is here to support layout tests that are currently |
// doing a readback in the renderer instead of the browser. So they |
@@ -157,7 +160,7 @@ void CompositorOutputSurface::SwapBuffers(cc::CompositorFrame* frame) { |
} else { |
base::MessageLoopProxy::current()->PostTask(FROM_HERE, closure); |
} |
- DidSwapBuffers(); |
+ client_->DidSwapBuffers(); |
return; |
} |
@@ -165,7 +168,7 @@ void CompositorOutputSurface::SwapBuffers(cc::CompositorFrame* frame) { |
Send(new ViewHostMsg_SwapCompositorFrame(routing_id_, |
output_surface_id_, |
*frame)); |
- DidSwapBuffers(); |
+ client_->DidSwapBuffers(); |
return; |
} |
@@ -178,8 +181,6 @@ void CompositorOutputSurface::SwapBuffers(cc::CompositorFrame* frame) { |
DCHECK(command_buffer_proxy); |
command_buffer_proxy->SetLatencyInfo(frame->metadata.latency_info); |
} |
- |
- OutputSurface::SwapBuffers(frame); |
} |
void CompositorOutputSurface::OnMessageReceived(const IPC::Message& message) { |
@@ -209,12 +210,11 @@ void CompositorOutputSurface::SetNeedsBeginFrame(bool enable) { |
DCHECK(CalledOnValidThread()); |
if (needs_begin_frame_ != enable) |
Send(new ViewHostMsg_SetNeedsBeginFrame(routing_id_, enable)); |
- OutputSurface::SetNeedsBeginFrame(enable); |
} |
void CompositorOutputSurface::OnBeginFrame(const cc::BeginFrameArgs& args) { |
DCHECK(CalledOnValidThread()); |
- BeginFrame(args); |
+ client->BeginFrame(args); |
} |
#endif // defined(OS_ANDROID) |
@@ -224,8 +224,11 @@ void CompositorOutputSurface::OnSwapAck(uint32 output_surface_id, |
// (e.g. after a lost context). |
if (output_surface_id != output_surface_id_) |
return; |
+ // Also ignore message if the current output surface's context is lost. |
+ if (is_lost_) |
+ return; |
ReclaimResources(&ack); |
- OnSwapBuffersComplete(); |
+ client_->DidSwapBuffersComplete(); |
} |
void CompositorOutputSurface::OnReclaimResources( |