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 55af86511874200491b0fe4375394b73aa1c2948..755da6d29bef7f32c7f55ec69b03316cde363803 100644 |
| --- a/content/renderer/gpu/compositor_output_surface.cc |
| +++ b/content/renderer/gpu/compositor_output_surface.cc |
| @@ -50,18 +50,17 @@ IPC::ForwardingMessageFilter* CompositorOutputSurface::CreateFilter( |
| CompositorOutputSurface::CompositorOutputSurface( |
| int32 routing_id, |
| WebGraphicsContext3DCommandBufferImpl* context3D, |
| - cc::SoftwareOutputDevice* software_device) |
| + cc::SoftwareOutputDevice* software_device, |
| + bool swap_buffers_via_ipc) |
| : OutputSurface(scoped_ptr<WebKit::WebGraphicsContext3D>(context3D), |
| make_scoped_ptr(software_device)), |
| + swap_buffers_via_ipc_(swap_buffers_via_ipc), |
| output_surface_filter_( |
| RenderThreadImpl::current()->compositor_output_surface_filter()), |
| routing_id_(routing_id), |
| prefers_smoothness_(false), |
| main_thread_handle_(base::PlatformThread::CurrentHandle()) { |
| DCHECK(output_surface_filter_.get()); |
| - CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| - capabilities_.has_parent_compositor = command_line->HasSwitch( |
| - switches::kEnableDelegatedRenderer); |
| DetachFromThread(); |
| message_sender_ = RenderThreadImpl::current()->sync_message_filter(); |
| DCHECK(message_sender_.get()); |
| @@ -93,34 +92,28 @@ bool CompositorOutputSurface::BindToClient( |
| return true; |
| } |
| -void CompositorOutputSurface::SendFrameToParentCompositor( |
| - cc::CompositorFrame* frame) { |
| - DCHECK(CalledOnValidThread()); |
| - Send(new ViewHostMsg_SwapCompositorFrame(routing_id_, *frame)); |
| -} |
| +void CompositorOutputSurface::SwapBuffers(cc::CompositorFrame* frame) { |
| + if (swap_buffers_via_ipc_) { |
| + Send(new ViewHostMsg_SwapCompositorFrame(routing_id_, *frame)); |
| + return; |
| + } |
| -void CompositorOutputSurface::SwapBuffers( |
| - const ui::LatencyInfo& latency_info) { |
| - WebGraphicsContext3DCommandBufferImpl* command_buffer = |
| - static_cast<WebGraphicsContext3DCommandBufferImpl*>(context3d()); |
| - CommandBufferProxyImpl* command_buffer_proxy = |
| - command_buffer->GetCommandBufferProxy(); |
| - DCHECK(command_buffer_proxy); |
| - context3d()->shallowFlushCHROMIUM(); |
| - command_buffer_proxy->SetLatencyInfo(latency_info); |
| - OutputSurface::SwapBuffers(latency_info); |
| -} |
| + if (frame->software_frame_data) { |
| + client_->OnSwapBuffersComplete(NULL); |
|
piman
2013/06/10 19:52:25
similar to concerns in the base OutputSurface: any
|
| + return; |
| + } |
| + |
| + DCHECK(frame->gl_frame_data); |
| -void CompositorOutputSurface::PostSubBuffer( |
| - gfx::Rect rect, const ui::LatencyInfo& latency_info) { |
| WebGraphicsContext3DCommandBufferImpl* command_buffer = |
| static_cast<WebGraphicsContext3DCommandBufferImpl*>(context3d()); |
| CommandBufferProxyImpl* command_buffer_proxy = |
| command_buffer->GetCommandBufferProxy(); |
| DCHECK(command_buffer_proxy); |
| context3d()->shallowFlushCHROMIUM(); |
| - command_buffer_proxy->SetLatencyInfo(latency_info); |
| - OutputSurface::PostSubBuffer(rect, latency_info); |
| + command_buffer_proxy->SetLatencyInfo(frame->metadata.latency_info); |
| + |
| + OutputSurface::SwapBuffers(frame); |
| } |
| void CompositorOutputSurface::OnMessageReceived(const IPC::Message& message) { |
| @@ -155,7 +148,7 @@ void CompositorOutputSurface::OnBeginFrame(base::TimeTicks frame_time) { |
| #endif // defined(OS_ANDROID) |
| void CompositorOutputSurface::OnSwapAck(const cc::CompositorFrameAck& ack) { |
| - client_->OnSendFrameToParentCompositorAck(ack); |
| + client_->OnSwapBuffersComplete(&ack); |
| } |
| bool CompositorOutputSurface::Send(IPC::Message* message) { |