Remove PlatformFile from profile_browsertest
[chromium-blink-merge.git] / content / browser / compositor / gpu_browser_compositor_output_surface.cc
blob32a43fd56df692de52da842e83de4380a4324bab
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "content/browser/compositor/gpu_browser_compositor_output_surface.h"
7 #include "cc/output/compositor_frame.h"
8 #include "content/browser/compositor/reflector_impl.h"
9 #include "content/common/gpu/client/context_provider_command_buffer.h"
10 #include "gpu/command_buffer/client/gles2_interface.h"
12 namespace content {
14 GpuBrowserCompositorOutputSurface::GpuBrowserCompositorOutputSurface(
15 const scoped_refptr<ContextProviderCommandBuffer>& context,
16 int surface_id,
17 IDMap<BrowserCompositorOutputSurface>* output_surface_map,
18 const scoped_refptr<ui::CompositorVSyncManager>& vsync_manager)
19 : BrowserCompositorOutputSurface(context,
20 surface_id,
21 output_surface_map,
22 vsync_manager) {}
24 GpuBrowserCompositorOutputSurface::~GpuBrowserCompositorOutputSurface() {}
26 void GpuBrowserCompositorOutputSurface::SwapBuffers(
27 cc::CompositorFrame* frame) {
28 DCHECK(frame->gl_frame_data);
30 ContextProviderCommandBuffer* provider_command_buffer =
31 static_cast<ContextProviderCommandBuffer*>(context_provider_.get());
32 CommandBufferProxyImpl* command_buffer_proxy =
33 provider_command_buffer->GetCommandBufferProxy();
34 DCHECK(command_buffer_proxy);
35 context_provider_->ContextGL()->ShallowFlushCHROMIUM();
36 command_buffer_proxy->SetLatencyInfo(frame->metadata.latency_info);
38 if (reflector_.get()) {
39 if (frame->gl_frame_data->sub_buffer_rect ==
40 gfx::Rect(frame->gl_frame_data->size))
41 reflector_->OnSwapBuffers();
42 else
43 reflector_->OnPostSubBuffer(frame->gl_frame_data->sub_buffer_rect);
46 OutputSurface::SwapBuffers(frame);
49 } // namespace content