Chromium Code Reviews| Index: content/browser/compositor/gpu_browser_compositor_output_surface.cc |
| diff --git a/content/browser/compositor/gpu_browser_compositor_output_surface.cc b/content/browser/compositor/gpu_browser_compositor_output_surface.cc |
| index efa805261e9d914d261aeaf5d7f46b7119ce8646..23b3308e125e954badafe2d69239e2c1e23d255a 100644 |
| --- a/content/browser/compositor/gpu_browser_compositor_output_surface.cc |
| +++ b/content/browser/compositor/gpu_browser_compositor_output_surface.cc |
| @@ -5,8 +5,11 @@ |
| #include "content/browser/compositor/gpu_browser_compositor_output_surface.h" |
| #include "cc/output/compositor_frame.h" |
| +#include "cc/output/output_surface_client.h" |
| #include "content/browser/compositor/reflector_impl.h" |
| +#include "content/browser/renderer_host/render_widget_host_impl.h" |
| #include "content/common/gpu/client/context_provider_command_buffer.h" |
| +#include "gpu/command_buffer/client/context_support.h" |
| #include "gpu/command_buffer/client/gles2_interface.h" |
| namespace content { |
| @@ -35,7 +38,9 @@ void GpuBrowserCompositorOutputSurface::SwapBuffers( |
| CommandBufferProxyImpl* command_buffer_proxy = |
| provider_command_buffer->GetCommandBufferProxy(); |
| DCHECK(command_buffer_proxy); |
| - command_buffer_proxy->SetLatencyInfo(frame->metadata.latency_info); |
| + command_buffer_proxy->SetLatencyInfo(frame->metadata.latency_info, |
| + base::Bind(&GpuBrowserCompositorOutputSurface::OnSwapBuffersCompleted, |
| + base::Unretained(this))); |
|
piman
2014/10/07 02:30:39
Because ContextProvider is refcounted, it might ou
no sievers
2014/10/07 19:47:24
Done. I've used CancelableCallback (which essentia
|
| if (reflector_.get()) { |
| if (frame->gl_frame_data->sub_buffer_rect == |
| @@ -45,7 +50,21 @@ void GpuBrowserCompositorOutputSurface::SwapBuffers( |
| reflector_->OnPostSubBuffer(frame->gl_frame_data->sub_buffer_rect); |
| } |
| - OutputSurface::SwapBuffers(frame); |
| + if (frame->gl_frame_data->sub_buffer_rect == |
| + gfx::Rect(frame->gl_frame_data->size)) { |
| + context_provider_->ContextSupport()->Swap(); |
| + } else { |
| + context_provider_->ContextSupport()->PartialSwapBuffers( |
| + frame->gl_frame_data->sub_buffer_rect); |
| + } |
| + |
| + client_->DidSwapBuffers(); |
| +} |
| + |
| +void GpuBrowserCompositorOutputSurface::OnSwapBuffersCompleted( |
| + const std::vector<ui::LatencyInfo>& latency_info) { |
| + RenderWidgetHostImpl::CompositorFrameDrawn(latency_info); |
| + BrowserCompositorOutputSurface::OnSwapBuffersComplete(); |
| } |
| } // namespace content |