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 const scoped_refptr<ui::CompositorVSyncManager>& vsync_manager, | |
19 scoped_ptr<cc::OverlayCandidateValidator> overlay_candidate_validator) | 18 scoped_ptr<cc::OverlayCandidateValidator> overlay_candidate_validator) |
20 : BrowserCompositorOutputSurface(context, | 19 : BrowserCompositorOutputSurface(context, surface_id, output_surface_map) { |
21 surface_id, | |
22 output_surface_map, | |
23 vsync_manager) { | |
24 overlay_candidate_validator_ = overlay_candidate_validator.Pass(); | 20 overlay_candidate_validator_ = overlay_candidate_validator.Pass(); |
25 } | 21 } |
26 | 22 |
27 GpuBrowserCompositorOutputSurface::~GpuBrowserCompositorOutputSurface() {} | 23 GpuBrowserCompositorOutputSurface::~GpuBrowserCompositorOutputSurface() {} |
28 | 24 |
29 void GpuBrowserCompositorOutputSurface::SwapBuffers( | 25 void GpuBrowserCompositorOutputSurface::SwapBuffers( |
30 cc::CompositorFrame* frame) { | 26 cc::CompositorFrame* frame) { |
31 DCHECK(frame->gl_frame_data); | 27 DCHECK(frame->gl_frame_data); |
32 | 28 |
33 ContextProviderCommandBuffer* provider_command_buffer = | 29 ContextProviderCommandBuffer* provider_command_buffer = |
34 static_cast<ContextProviderCommandBuffer*>(context_provider_.get()); | 30 static_cast<ContextProviderCommandBuffer*>(context_provider_.get()); |
35 CommandBufferProxyImpl* command_buffer_proxy = | 31 CommandBufferProxyImpl* command_buffer_proxy = |
36 provider_command_buffer->GetCommandBufferProxy(); | 32 provider_command_buffer->GetCommandBufferProxy(); |
37 DCHECK(command_buffer_proxy); | 33 DCHECK(command_buffer_proxy); |
38 context_provider_->ContextGL()->ShallowFlushCHROMIUM(); | 34 context_provider_->ContextGL()->ShallowFlushCHROMIUM(); |
39 command_buffer_proxy->SetLatencyInfo(frame->metadata.latency_info); | 35 command_buffer_proxy->SetLatencyInfo(frame->metadata.latency_info); |
40 | 36 |
41 if (reflector_.get()) { | 37 if (reflector_.get()) { |
42 if (frame->gl_frame_data->sub_buffer_rect == | 38 if (frame->gl_frame_data->sub_buffer_rect == |
43 gfx::Rect(frame->gl_frame_data->size)) | 39 gfx::Rect(frame->gl_frame_data->size)) |
44 reflector_->OnSwapBuffers(); | 40 reflector_->OnSwapBuffers(); |
45 else | 41 else |
46 reflector_->OnPostSubBuffer(frame->gl_frame_data->sub_buffer_rect); | 42 reflector_->OnPostSubBuffer(frame->gl_frame_data->sub_buffer_rect); |
47 } | 43 } |
48 | 44 |
49 OutputSurface::SwapBuffers(frame); | 45 OutputSurface::SwapBuffers(frame); |
50 } | 46 } |
51 | 47 |
52 } // namespace content | 48 } // namespace content |
OLD | NEW |