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

Side by Side Diff: content/renderer/gpu/compositor_output_surface.cc

Issue 2002303002: Consolidate OutputSurface constructors into GL vs Vulkan. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: outputsurface-constructors: . Created 4 years, 7 months 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/renderer/gpu/compositor_output_surface.h" 5 #include "content/renderer/gpu/compositor_output_surface.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 12 matching lines...) Expand all
23 #include "gpu/command_buffer/client/context_support.h" 23 #include "gpu/command_buffer/client/context_support.h"
24 #include "gpu/command_buffer/client/gles2_interface.h" 24 #include "gpu/command_buffer/client/gles2_interface.h"
25 #include "gpu/ipc/client/command_buffer_proxy_impl.h" 25 #include "gpu/ipc/client/command_buffer_proxy_impl.h"
26 #include "ipc/ipc_sync_channel.h" 26 #include "ipc/ipc_sync_channel.h"
27 27
28 namespace content { 28 namespace content {
29 29
30 CompositorOutputSurface::CompositorOutputSurface( 30 CompositorOutputSurface::CompositorOutputSurface(
31 int32_t routing_id, 31 int32_t routing_id,
32 uint32_t output_surface_id, 32 uint32_t output_surface_id,
33 const scoped_refptr<ContextProviderCommandBuffer>& context_provider, 33 scoped_refptr<cc::ContextProvider> context_provider,
34 const scoped_refptr<ContextProviderCommandBuffer>& worker_context_provider, 34 scoped_refptr<cc::ContextProvider> worker_context_provider,
35 const scoped_refptr<cc::VulkanContextProvider>& vulkan_context_provider, 35 scoped_refptr<FrameSwapMessageQueue> swap_frame_message_queue)
36 std::unique_ptr<cc::SoftwareOutputDevice> software_device, 36 : OutputSurface(std::move(context_provider),
37 scoped_refptr<FrameSwapMessageQueue> swap_frame_message_queue, 37 std::move(worker_context_provider),
38 bool use_swap_compositor_frame_message) 38 nullptr),
39 : OutputSurface(context_provider,
40 worker_context_provider,
41 vulkan_context_provider,
42 std::move(software_device)),
43 output_surface_id_(output_surface_id), 39 output_surface_id_(output_surface_id),
44 use_swap_compositor_frame_message_(use_swap_compositor_frame_message),
45 output_surface_filter_( 40 output_surface_filter_(
46 RenderThreadImpl::current()->compositor_message_filter()), 41 RenderThreadImpl::current()->compositor_message_filter()),
42 message_sender_(RenderThreadImpl::current()->sync_message_filter()),
47 frame_swap_message_queue_(swap_frame_message_queue), 43 frame_swap_message_queue_(swap_frame_message_queue),
48 routing_id_(routing_id), 44 routing_id_(routing_id),
49 layout_test_mode_(RenderThreadImpl::current()->layout_test_mode()), 45 layout_test_mode_(RenderThreadImpl::current()->layout_test_mode()),
50 weak_ptrs_(this) { 46 weak_ptrs_(this) {
51 DCHECK(output_surface_filter_.get()); 47 DCHECK(output_surface_filter_);
52 DCHECK(frame_swap_message_queue_.get()); 48 DCHECK(frame_swap_message_queue_);
53 message_sender_ = RenderThreadImpl::current()->sync_message_filter(); 49 DCHECK(message_sender_);
54 DCHECK(message_sender_.get()); 50 capabilities_.delegated_rendering = true;
danakj 2016/05/23 21:14:28 Oh. Mailbox output surface :/ I can't do this.
danakj 2016/05/23 21:31:26 I'm going to try split Mailbox from Compositor out
55 } 51 }
56 52
57 CompositorOutputSurface::~CompositorOutputSurface() {} 53 CompositorOutputSurface::CompositorOutputSurface(
54 int32_t routing_id,
55 uint32_t output_surface_id,
56 scoped_refptr<cc::VulkanContextProvider> vulkan_context_provider,
57 scoped_refptr<FrameSwapMessageQueue> swap_frame_message_queue)
58 : OutputSurface(std::move(vulkan_context_provider), nullptr),
59 output_surface_id_(output_surface_id),
60 output_surface_filter_(
61 RenderThreadImpl::current()->compositor_message_filter()),
62 message_sender_(RenderThreadImpl::current()->sync_message_filter()),
63 frame_swap_message_queue_(swap_frame_message_queue),
64 routing_id_(routing_id),
65 layout_test_mode_(RenderThreadImpl::current()->layout_test_mode()),
66 weak_ptrs_(this) {
67 DCHECK(output_surface_filter_);
68 DCHECK(frame_swap_message_queue_);
69 DCHECK(message_sender_);
70 capabilities_.delegated_rendering = true;
71 }
72
73 CompositorOutputSurface::~CompositorOutputSurface() = default;
58 74
59 bool CompositorOutputSurface::BindToClient( 75 bool CompositorOutputSurface::BindToClient(
60 cc::OutputSurfaceClient* client) { 76 cc::OutputSurfaceClient* client) {
61 if (!cc::OutputSurface::BindToClient(client)) 77 if (!cc::OutputSurface::BindToClient(client))
62 return false; 78 return false;
63 79
64 output_surface_proxy_ = new CompositorOutputSurfaceProxy(this); 80 output_surface_proxy_ = new CompositorOutputSurfaceProxy(this);
65 output_surface_filter_handler_ = 81 output_surface_filter_handler_ =
66 base::Bind(&CompositorOutputSurfaceProxy::OnMessageReceived, 82 base::Bind(&CompositorOutputSurfaceProxy::OnMessageReceived,
67 output_surface_proxy_); 83 output_surface_proxy_);
(...skipping 30 matching lines...) Expand all
98 layout_test_previous_frame_ack_.reset(new cc::CompositorFrameAck); 114 layout_test_previous_frame_ack_.reset(new cc::CompositorFrameAck);
99 layout_test_previous_frame_ack_->gl_frame_data.reset(new cc::GLFrameData); 115 layout_test_previous_frame_ack_->gl_frame_data.reset(new cc::GLFrameData);
100 } 116 }
101 117
102 OnSwapAck(output_surface_id, *layout_test_previous_frame_ack_); 118 OnSwapAck(output_surface_id, *layout_test_previous_frame_ack_);
103 119
104 layout_test_previous_frame_ack_->gl_frame_data = std::move(gl_frame_data); 120 layout_test_previous_frame_ack_->gl_frame_data = std::move(gl_frame_data);
105 } 121 }
106 122
107 void CompositorOutputSurface::SwapBuffers(cc::CompositorFrame* frame) { 123 void CompositorOutputSurface::SwapBuffers(cc::CompositorFrame* frame) {
108 DCHECK(use_swap_compositor_frame_message_);
109 if (layout_test_mode_) { 124 if (layout_test_mode_) {
110 // This code path is here to support layout tests that are currently 125 // This code path is here to support layout tests that are currently
111 // doing a readback in the renderer instead of the browser. So they 126 // doing a readback in the renderer instead of the browser. So they
112 // are using deprecated code paths in the renderer and don't need to 127 // are using deprecated code paths in the renderer and don't need to
113 // actually swap anything to the browser. We shortcut the swap to the 128 // actually swap anything to the browser. We shortcut the swap to the
114 // browser here and just ack directly within the renderer process. 129 // browser here and just ack directly within the renderer process.
115 // Once crbug.com/311404 is fixed, this can be removed. 130 // Once crbug.com/311404 is fixed, this can be removed.
116 131
117 // This would indicate that crbug.com/311404 is being fixed, and this 132 // This would indicate that crbug.com/311404 is being fixed, and this
118 // block needs to be removed. 133 // block needs to be removed.
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 if (output_surface_id != output_surface_id_) 213 if (output_surface_id != output_surface_id_)
199 return; 214 return;
200 ReclaimResources(&ack); 215 ReclaimResources(&ack);
201 } 216 }
202 217
203 bool CompositorOutputSurface::Send(IPC::Message* message) { 218 bool CompositorOutputSurface::Send(IPC::Message* message) {
204 return message_sender_->Send(message); 219 return message_sender_->Send(message);
205 } 220 }
206 221
207 } // namespace content 222 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698