Chromium Code Reviews| 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 7cb51996d4fc94e9ac117a4d0302bc010836f7ff..2a3e2d57dec972ad8b71b6a3871591aab9ee8f8e 100644 |
| --- a/content/renderer/gpu/compositor_output_surface.cc |
| +++ b/content/renderer/gpu/compositor_output_surface.cc |
| @@ -61,6 +61,7 @@ CompositorOutputSurface::CompositorOutputSurface( |
| RenderThreadImpl::current()->compositor_output_surface_filter()), |
| routing_id_(routing_id), |
| prefers_smoothness_(false), |
| + layout_test_mode_(RenderThreadImpl::current()->layout_test_mode()), |
| #if defined(OS_WIN) |
| // TODO(epenner): Implement PlatformThread::CurrentHandle() on windows. |
| main_thread_handle_(base::PlatformThreadHandle()) |
| @@ -111,7 +112,42 @@ bool CompositorOutputSurface::BindToClient( |
| return true; |
| } |
| +void CompositorOutputSurface::ShortcutSwapAck( |
| + int output_surface_id, |
| + scoped_ptr<cc::CompositorFrameAck> ack) { |
| + ReclaimResources(ack.get()); |
| + OnSwapBuffersComplete(); |
| +} |
| + |
| void CompositorOutputSurface::SwapBuffers(cc::CompositorFrame* frame) { |
| + if (layout_test_mode_) { |
| + // This code path is here to support layout tests that are currently |
| + // doing a readback in the renderer instead of the browser. So they |
| + // are using deprecated code paths in the renderer and don't need to |
| + // actually swap anything to the browser. We shortcut the swap to the |
| + // browser here and just ack directly within the renderer process. |
| + // Once crbug.com/311404 is fixed, this can be removed. |
| + DCHECK(use_swap_compositor_frame_message_); |
| + DidSwapBuffers(); |
| + |
| + // This would indicate that crbug.com/311404 is being fixed, and this |
| + // block needs to be removed. |
| + DCHECK(!frame->delegated_frame_data); |
| + |
| + scoped_ptr<cc::CompositorFrameAck> ack(new cc::CompositorFrameAck); |
| + if (frame->gl_frame_data) |
| + ack->gl_frame_data = frame->gl_frame_data.Pass(); |
| + if (frame->software_frame_data) |
| + ack->last_software_frame_id = frame->software_frame_data->id; |
| + base::MessageLoopProxy::current()->PostTask( |
| + FROM_HERE, |
| + base::Bind(&CompositorOutputSurface::ShortcutSwapAck, |
| + base::Unretained(this), |
|
piman
2014/02/07 21:51:24
Is this Unretained safe?
danakj
2014/02/07 21:58:44
I *think* so, cuz I'm not seeing crashes on layout
piman
2014/02/07 23:07:17
I don't see anything that would guarantee it.
On s
danakj
2014/02/08 00:55:32
ok! done.
|
| + output_surface_id_, |
|
piman
2014/02/07 21:51:24
nit: You're not using this AFAICT
danakj
2014/02/07 21:58:44
Oh, ya. I was passing this to the OnSwapAck() but
|
| + base::Passed(&ack))); |
| + return; |
| + } |
| + |
| if (use_swap_compositor_frame_message_) { |
| Send(new ViewHostMsg_SwapCompositorFrame(routing_id_, |
| output_surface_id_, |