Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1382)

Side by Side Diff: content/browser/compositor/vulkan_browser_compositor_output_surface.cc

Issue 2472433002: Fixed compile- and link-time errors with the "enable_vulkan" GN-argument (Closed)
Patch Set: Augmented the AUTHORS file per reviewers request. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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(std::move(context),
18 vsync_manager, 18 std::move(vsync_manager),
19 begin_frame_source) {} 19 begin_frame_source),
20 weak_ptr_factory_(this) {}
20 21
21 VulkanBrowserCompositorOutputSurface::~VulkanBrowserCompositorOutputSurface() { 22 VulkanBrowserCompositorOutputSurface::~VulkanBrowserCompositorOutputSurface() {
22 Destroy(); 23 Destroy();
23 } 24 }
24 25
25 bool VulkanBrowserCompositorOutputSurface::Initialize( 26 bool VulkanBrowserCompositorOutputSurface::Initialize(
26 gfx::AcceleratedWidget widget) { 27 gfx::AcceleratedWidget widget) {
27 DCHECK(!surface_); 28 DCHECK(!surface_);
28 std::unique_ptr<gpu::VulkanSurface> surface( 29 std::unique_ptr<gpu::VulkanSurface> surface(
29 gpu::VulkanSurface::CreateViewSurface(widget)); 30 gpu::VulkanSurface::CreateViewSurface(widget));
30 if (!surface->Initialize(vulkan_context_provider()->GetDeviceQueue(), 31 if (!surface->Initialize(vulkan_context_provider()->GetDeviceQueue(),
31 gpu::VulkanSurface::DEFAULT_SURFACE_FORMAT)) { 32 gpu::VulkanSurface::DEFAULT_SURFACE_FORMAT)) {
32 return false; 33 return false;
33 } 34 }
34 surface_ = std::move(surface); 35 surface_ = std::move(surface);
35 36
36 return true; 37 return true;
37 } 38 }
38 39
39 void VulkanBrowserCompositorOutputSurface::Destroy() { 40 void VulkanBrowserCompositorOutputSurface::Destroy() {
40 if (surface_) { 41 if (surface_) {
41 surface_->Destroy(); 42 surface_->Destroy();
42 surface_.reset(); 43 surface_.reset();
43 } 44 }
44 } 45 }
45 46
46 void VulkanBrowserCompositorOutputSurface::OnGpuSwapBuffersCompleted( 47 void VulkanBrowserCompositorOutputSurface::BindToClient(
47 const std::vector<ui::LatencyInfo>& latency_info, 48 cc::OutputSurfaceClient* client) {
48 gfx::SwapResult result, 49 DCHECK(client);
49 const gpu::GpuProcessHostedCALayerTreeParamsMac* params_mac) { 50 DCHECK(!client_);
50 RenderWidgetHostImpl::CompositorFrameDrawn(latency_info); 51 client_ = client;
52 }
53
54 void VulkanBrowserCompositorOutputSurface::EnsureBackbuffer() {
55 NOTIMPLEMENTED();
56 }
57
58 void VulkanBrowserCompositorOutputSurface::DiscardBackbuffer() {
59 NOTIMPLEMENTED();
60 }
61
62 void VulkanBrowserCompositorOutputSurface::BindFramebuffer() {
63 NOTIMPLEMENTED();
64 }
65
66 bool VulkanBrowserCompositorOutputSurface::IsDisplayedAsOverlayPlane() const {
67 NOTIMPLEMENTED();
68 return false;
69 }
70
71 unsigned VulkanBrowserCompositorOutputSurface::GetOverlayTextureId() const {
72 NOTIMPLEMENTED();
73 return 0;
74 }
75
76 bool VulkanBrowserCompositorOutputSurface::SurfaceIsSuspendForRecycle() const {
77 NOTIMPLEMENTED();
78 return false;
79 }
80
81 void VulkanBrowserCompositorOutputSurface::Reshape(
82 const gfx::Size& size,
83 float device_scale_factor,
84 const gfx::ColorSpace& color_space,
85 bool has_alpha) {
86 NOTIMPLEMENTED();
87 }
88
89 uint32_t
90 VulkanBrowserCompositorOutputSurface::GetFramebufferCopyTextureFormat() {
91 NOTIMPLEMENTED();
92 return 0;
93 }
94
95 void VulkanBrowserCompositorOutputSurface::SwapBuffers(
96 cc::OutputSurfaceFrame frame) {
97 surface_->SwapBuffers();
98
99 base::ThreadTaskRunnerHandle::Get()->PostTask(
100 FROM_HERE,
101 base::Bind(&VulkanBrowserCompositorOutputSurface::SwapBuffersAck,
102 weak_ptr_factory_.GetWeakPtr()));
103 }
104
105 void VulkanBrowserCompositorOutputSurface::SwapBuffersAck() {
106 DCHECK(client_);
51 client_->DidReceiveSwapBuffersAck(); 107 client_->DidReceiveSwapBuffersAck();
52 } 108 }
53 109
54 void VulkanBrowserCompositorOutputSurface::SwapBuffers(
55 cc::CompositorFrame* frame) {
56 surface_->SwapBuffers();
57 }
58
59 } // namespace content 110 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/compositor/vulkan_browser_compositor_output_surface.h ('k') | gpu/vulkan/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698