OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/browser/compositor/gpu_browser_compositor_output_surface.h" | 5 #include "content/browser/compositor/gpu_browser_compositor_output_surface.h" |
6 | 6 |
7 #include "cc/output/compositor_frame.h" | 7 #include "cc/output/compositor_frame.h" |
8 #include "content/browser/compositor/reflector_impl.h" | 8 #include "content/browser/compositor/reflector_impl.h" |
9 #include "content/common/gpu/client/context_provider_command_buffer.h" | 9 #include "content/common/gpu/client/context_provider_command_buffer.h" |
10 #include "gpu/command_buffer/client/gles2_interface.h" | 10 #include "gpu/command_buffer/client/gles2_interface.h" |
11 | 11 |
12 namespace content { | 12 namespace content { |
13 | 13 |
14 GpuBrowserCompositorOutputSurface::GpuBrowserCompositorOutputSurface( | 14 GpuBrowserCompositorOutputSurface::GpuBrowserCompositorOutputSurface( |
15 const scoped_refptr<ContextProviderCommandBuffer>& context, | 15 const scoped_refptr<ContextProviderCommandBuffer>& context, |
16 int surface_id, | 16 int surface_id, |
17 IDMap<BrowserCompositorOutputSurface>* output_surface_map, | 17 IDMap<BrowserCompositorOutputSurface>* output_surface_map, |
18 base::MessageLoopProxy* compositor_message_loop, | 18 const scoped_refptr<ui::CompositorVSyncManager>& vsync_manager) |
19 base::WeakPtr<ui::Compositor> compositor) | |
20 : BrowserCompositorOutputSurface(context, | 19 : BrowserCompositorOutputSurface(context, |
21 surface_id, | 20 surface_id, |
22 output_surface_map, | 21 output_surface_map, |
23 compositor_message_loop, | 22 vsync_manager) {} |
24 compositor) {} | |
25 | 23 |
26 GpuBrowserCompositorOutputSurface::~GpuBrowserCompositorOutputSurface() {} | 24 GpuBrowserCompositorOutputSurface::~GpuBrowserCompositorOutputSurface() {} |
27 | 25 |
28 void GpuBrowserCompositorOutputSurface::SwapBuffers( | 26 void GpuBrowserCompositorOutputSurface::SwapBuffers( |
29 cc::CompositorFrame* frame) { | 27 cc::CompositorFrame* frame) { |
30 DCHECK(frame->gl_frame_data); | 28 DCHECK(frame->gl_frame_data); |
31 | 29 |
32 ContextProviderCommandBuffer* provider_command_buffer = | 30 ContextProviderCommandBuffer* provider_command_buffer = |
33 static_cast<ContextProviderCommandBuffer*>(context_provider_.get()); | 31 static_cast<ContextProviderCommandBuffer*>(context_provider_.get()); |
34 CommandBufferProxyImpl* command_buffer_proxy = | 32 CommandBufferProxyImpl* command_buffer_proxy = |
35 provider_command_buffer->GetCommandBufferProxy(); | 33 provider_command_buffer->GetCommandBufferProxy(); |
36 DCHECK(command_buffer_proxy); | 34 DCHECK(command_buffer_proxy); |
37 context_provider_->ContextGL()->ShallowFlushCHROMIUM(); | 35 context_provider_->ContextGL()->ShallowFlushCHROMIUM(); |
38 command_buffer_proxy->SetLatencyInfo(frame->metadata.latency_info); | 36 command_buffer_proxy->SetLatencyInfo(frame->metadata.latency_info); |
39 | 37 |
40 if (reflector_.get()) { | 38 if (reflector_.get()) { |
41 if (frame->gl_frame_data->sub_buffer_rect == | 39 if (frame->gl_frame_data->sub_buffer_rect == |
42 gfx::Rect(frame->gl_frame_data->size)) | 40 gfx::Rect(frame->gl_frame_data->size)) |
43 reflector_->OnSwapBuffers(); | 41 reflector_->OnSwapBuffers(); |
44 else | 42 else |
45 reflector_->OnPostSubBuffer(frame->gl_frame_data->sub_buffer_rect); | 43 reflector_->OnPostSubBuffer(frame->gl_frame_data->sub_buffer_rect); |
46 } | 44 } |
47 | 45 |
48 OutputSurface::SwapBuffers(frame); | 46 OutputSurface::SwapBuffers(frame); |
49 } | 47 } |
50 | 48 |
51 } // namespace content | 49 } // namespace content |
OLD | NEW |