Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 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/vulkan_browser_compositor_output_surface.h" | 5 #include "content/browser/compositor/vulkan_browser_compositor_output_surface.h" |
| 6 | 6 |
| 7 #include "cc/output/output_surface_client.h" | 7 #include "cc/output/output_surface_client.h" |
| 8 #include "content/browser/renderer_host/render_widget_host_impl.h" | 8 #include "content/browser/renderer_host/render_widget_host_impl.h" |
| 9 #include "gpu/vulkan/vulkan_surface.h" | 9 #include "gpu/vulkan/vulkan_surface.h" |
| 10 | 10 |
| 11 namespace content { | 11 namespace content { |
| 12 | 12 |
| 13 VulkanBrowserCompositorOutputSurface::VulkanBrowserCompositorOutputSurface( | 13 VulkanBrowserCompositorOutputSurface::VulkanBrowserCompositorOutputSurface( |
| 14 const scoped_refptr<cc::VulkanContextProvider>& context, | 14 scoped_refptr<cc::VulkanContextProvider> context, |
| 15 const scoped_refptr<ui::CompositorVSyncManager>& vsync_manager, | 15 scoped_refptr<ui::CompositorVSyncManager> vsync_manager, |
| 16 cc::SyntheticBeginFrameSource* begin_frame_source) | 16 cc::SyntheticBeginFrameSource* begin_frame_source) |
| 17 : BrowserCompositorOutputSurface(context, | 17 : BrowserCompositorOutputSurface(context, |
|
danakj
2016/11/01 18:48:23
std::move
Sergey.Kipet
2016/11/04 22:15:36
Done.
| |
| 18 vsync_manager, | 18 vsync_manager, |
|
danakj
2016/11/01 18:48:23
same
Sergey.Kipet
2016/11/04 22:15:36
Done.
| |
| 19 begin_frame_source) {} | 19 begin_frame_source) {} |
| 20 | 20 |
| 21 VulkanBrowserCompositorOutputSurface::~VulkanBrowserCompositorOutputSurface() { | 21 VulkanBrowserCompositorOutputSurface::~VulkanBrowserCompositorOutputSurface() { |
| 22 Destroy(); | 22 Destroy(); |
| 23 } | 23 } |
| 24 | 24 |
| 25 bool VulkanBrowserCompositorOutputSurface::Initialize( | 25 bool VulkanBrowserCompositorOutputSurface::Initialize( |
| 26 gfx::AcceleratedWidget widget) { | 26 gfx::AcceleratedWidget widget) { |
| 27 DCHECK(!surface_); | 27 DCHECK(!surface_); |
| 28 std::unique_ptr<gpu::VulkanSurface> surface( | 28 std::unique_ptr<gpu::VulkanSurface> surface( |
| 29 gpu::VulkanSurface::CreateViewSurface(widget)); | 29 gpu::VulkanSurface::CreateViewSurface(widget)); |
| 30 if (!surface->Initialize(vulkan_context_provider()->GetDeviceQueue(), | 30 if (!surface->Initialize(vulkan_context_provider()->GetDeviceQueue(), |
| 31 gpu::VulkanSurface::DEFAULT_SURFACE_FORMAT)) { | 31 gpu::VulkanSurface::DEFAULT_SURFACE_FORMAT)) { |
| 32 return false; | 32 return false; |
| 33 } | 33 } |
| 34 surface_ = std::move(surface); | 34 surface_ = std::move(surface); |
| 35 | 35 |
| 36 return true; | 36 return true; |
| 37 } | 37 } |
| 38 | 38 |
| 39 void VulkanBrowserCompositorOutputSurface::Destroy() { | 39 void VulkanBrowserCompositorOutputSurface::Destroy() { |
| 40 if (surface_) { | 40 if (surface_) { |
| 41 surface_->Destroy(); | 41 surface_->Destroy(); |
| 42 surface_.reset(); | 42 surface_.reset(); |
| 43 } | 43 } |
| 44 } | 44 } |
| 45 | 45 |
| 46 void VulkanBrowserCompositorOutputSurface::OnGpuSwapBuffersCompleted( | 46 void VulkanBrowserCompositorOutputSurface::EnsureBackbuffer() { |
| 47 const std::vector<ui::LatencyInfo>& latency_info, | 47 NOTIMPLEMENTED(); |
| 48 gfx::SwapResult result, | 48 } |
| 49 const gpu::GpuProcessHostedCALayerTreeParamsMac* params_mac) { | 49 |
| 50 RenderWidgetHostImpl::CompositorFrameDrawn(latency_info); | 50 void VulkanBrowserCompositorOutputSurface::DiscardBackbuffer() { |
| 51 client_->DidReceiveSwapBuffersAck(); | 51 NOTIMPLEMENTED(); |
| 52 } | |
| 53 | |
| 54 void VulkanBrowserCompositorOutputSurface::BindFramebuffer() { | |
| 55 NOTIMPLEMENTED(); | |
| 56 } | |
| 57 | |
| 58 bool VulkanBrowserCompositorOutputSurface::IsDisplayedAsOverlayPlane() const { | |
| 59 NOTIMPLEMENTED(); | |
| 60 return false; | |
| 61 } | |
| 62 | |
| 63 unsigned VulkanBrowserCompositorOutputSurface::GetOverlayTextureId() const { | |
| 64 NOTIMPLEMENTED(); | |
| 65 return 0; | |
| 66 } | |
| 67 | |
| 68 bool VulkanBrowserCompositorOutputSurface::SurfaceIsSuspendForRecycle() const { | |
| 69 NOTIMPLEMENTED(); | |
| 70 return false; | |
| 71 } | |
| 72 | |
| 73 void VulkanBrowserCompositorOutputSurface::Reshape( | |
| 74 const gfx::Size& size, | |
| 75 float device_scale_factor, | |
| 76 const gfx::ColorSpace& color_space, | |
| 77 bool has_alpha) { | |
| 78 NOTIMPLEMENTED(); | |
| 79 } | |
| 80 | |
| 81 uint32_t | |
| 82 VulkanBrowserCompositorOutputSurface::GetFramebufferCopyTextureFormat() { | |
| 83 NOTIMPLEMENTED(); | |
| 84 return 0; | |
| 52 } | 85 } |
| 53 | 86 |
| 54 void VulkanBrowserCompositorOutputSurface::SwapBuffers( | 87 void VulkanBrowserCompositorOutputSurface::SwapBuffers( |
| 55 cc::CompositorFrame* frame) { | 88 cc::OutputSurfaceFrame frame) { |
| 56 surface_->SwapBuffers(); | 89 surface_->SwapBuffers(); |
|
danakj
2016/11/01 18:48:23
This needs to post-task back a call to client_->Di
Sergey.Kipet
2016/11/04 22:15:36
Done.
| |
| 57 } | 90 } |
| 58 | 91 |
| 59 } // namespace content | 92 } // namespace content |
| OLD | NEW |