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

Side by Side Diff: services/ui/gpu/gpu_main.cc

Issue 2627993002: mus-gpu: Include GpuPreferences when requesting for GpuService. (Closed)
Patch Set: Created 3 years, 11 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
« no previous file with comments | « services/ui/gpu/gpu_main.h ('k') | services/ui/gpu/gpu_service.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 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 "services/ui/gpu/gpu_main.h" 5 #include "services/ui/gpu/gpu_main.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "gpu/ipc/common/gpu_memory_buffer_support.h" 10 #include "gpu/ipc/common/gpu_memory_buffer_support.h"
11 #include "gpu/ipc/gpu_in_process_thread_service.h" 11 #include "gpu/ipc/gpu_in_process_thread_service.h"
12 #include "gpu/ipc/service/gpu_memory_buffer_factory.h" 12 #include "gpu/ipc/service/gpu_memory_buffer_factory.h"
13 #include "gpu/ipc/service/gpu_watchdog_thread.h" 13 #include "gpu/ipc/service/gpu_watchdog_thread.h"
14 #include "services/ui/common/server_gpu_memory_buffer_manager.h" 14 #include "services/ui/common/server_gpu_memory_buffer_manager.h"
15 #include "services/ui/gpu/gpu_service.h" 15 #include "services/ui/gpu/gpu_service.h"
16 16
17 #if defined(OS_MACOSX)
18 #include "base/message_loop/message_pump_mac.h"
19 #endif
20
17 namespace { 21 namespace {
18 22
19 #if defined(USE_X11) 23 #if defined(USE_X11)
20 std::unique_ptr<base::MessagePump> CreateMessagePumpX11() { 24 std::unique_ptr<base::MessagePump> CreateMessagePumpX11() {
21 // TODO(sad): This should create a TYPE_UI message pump, and create a 25 // TODO(sad): This should create a TYPE_UI message pump, and create a
22 // PlatformEventSource when gpu process split happens. 26 // PlatformEventSource when gpu process split happens.
23 return base::MessageLoop::CreateMessagePumpForType( 27 return base::MessageLoop::CreateMessagePumpForType(
24 base::MessageLoop::TYPE_DEFAULT); 28 base::MessageLoop::TYPE_DEFAULT);
25 } 29 }
26 #endif // defined(USE_X11) 30 #endif // defined(USE_X11)
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 void GpuMain::OnStart() { 101 void GpuMain::OnStart() {
98 // |this| will outlive the gpu thread and so it's safe to use 102 // |this| will outlive the gpu thread and so it's safe to use
99 // base::Unretained here. 103 // base::Unretained here.
100 gpu_thread_.task_runner()->PostTask( 104 gpu_thread_.task_runner()->PostTask(
101 FROM_HERE, 105 FROM_HERE,
102 base::Bind(&GpuMain::InitOnGpuThread, base::Unretained(this), 106 base::Bind(&GpuMain::InitOnGpuThread, base::Unretained(this),
103 io_thread_.task_runner(), compositor_thread_.task_runner())); 107 io_thread_.task_runner(), compositor_thread_.task_runner()));
104 } 108 }
105 109
106 void GpuMain::CreateGpuService(mojom::GpuServiceRequest request, 110 void GpuMain::CreateGpuService(mojom::GpuServiceRequest request,
107 mojom::GpuHostPtr gpu_host) { 111 mojom::GpuHostPtr gpu_host,
112 const gpu::GpuPreferences& preferences) {
108 // |this| will outlive the gpu thread and so it's safe to use 113 // |this| will outlive the gpu thread and so it's safe to use
109 // base::Unretained here. 114 // base::Unretained here.
110 gpu_thread_.task_runner()->PostTask( 115 gpu_thread_.task_runner()->PostTask(
111 FROM_HERE, 116 FROM_HERE,
112 base::Bind(&GpuMain::CreateGpuServiceOnGpuThread, base::Unretained(this), 117 base::Bind(&GpuMain::CreateGpuServiceOnGpuThread, base::Unretained(this),
113 base::Passed(std::move(request)), 118 base::Passed(std::move(request)),
114 base::Passed(gpu_host.PassInterface()))); 119 base::Passed(gpu_host.PassInterface()), preferences));
115 } 120 }
116 121
117 void GpuMain::CreateDisplayCompositor( 122 void GpuMain::CreateDisplayCompositor(
118 cc::mojom::DisplayCompositorRequest request, 123 cc::mojom::DisplayCompositorRequest request,
119 cc::mojom::DisplayCompositorClientPtr client) { 124 cc::mojom::DisplayCompositorClientPtr client) {
120 if (!gpu_service_) { 125 if (!gpu_service_) {
121 pending_display_compositor_request_ = std::move(request); 126 pending_display_compositor_request_ = std::move(request);
122 pending_display_compositor_client_info_ = client.PassInterface(); 127 pending_display_compositor_client_info_ = client.PassInterface();
123 return; 128 return;
124 } 129 }
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 } 209 }
205 210
206 void GpuMain::TearDownOnGpuThread() { 211 void GpuMain::TearDownOnGpuThread() {
207 gpu_service_.reset(); 212 gpu_service_.reset();
208 gpu_memory_buffer_factory_.reset(); 213 gpu_memory_buffer_factory_.reset();
209 gpu_init_.reset(); 214 gpu_init_.reset();
210 } 215 }
211 216
212 void GpuMain::CreateGpuServiceOnGpuThread( 217 void GpuMain::CreateGpuServiceOnGpuThread(
213 mojom::GpuServiceRequest request, 218 mojom::GpuServiceRequest request,
214 mojom::GpuHostPtrInfo gpu_host_info) { 219 mojom::GpuHostPtrInfo gpu_host_info,
220 const gpu::GpuPreferences& preferences) {
215 mojom::GpuHostPtr gpu_host; 221 mojom::GpuHostPtr gpu_host;
216 gpu_host.Bind(std::move(gpu_host_info)); 222 gpu_host.Bind(std::move(gpu_host_info));
217 gpu_service_->InitializeWithHost(std::move(gpu_host)); 223 gpu_service_->InitializeWithHost(std::move(gpu_host), preferences);
218 gpu_service_->Bind(std::move(request)); 224 gpu_service_->Bind(std::move(request));
219 225
220 if (pending_display_compositor_request_.is_pending()) { 226 if (pending_display_compositor_request_.is_pending()) {
221 CreateDisplayCompositorInternal( 227 CreateDisplayCompositorInternal(
222 std::move(pending_display_compositor_request_), 228 std::move(pending_display_compositor_request_),
223 std::move(pending_display_compositor_client_info_)); 229 std::move(pending_display_compositor_client_info_));
224 } 230 }
225 } 231 }
226 232
227 void GpuMain::BindGpuInternalOnGpuThread(mojom::GpuServiceRequest request) { 233 void GpuMain::BindGpuInternalOnGpuThread(mojom::GpuServiceRequest request) {
228 gpu_service_->Bind(std::move(request)); 234 gpu_service_->Bind(std::move(request));
229 } 235 }
230 236
231 void GpuMain::PreSandboxStartup() { 237 void GpuMain::PreSandboxStartup() {
232 // TODO(sad): https://crbug.com/645602 238 // TODO(sad): https://crbug.com/645602
233 } 239 }
234 240
235 bool GpuMain::EnsureSandboxInitialized( 241 bool GpuMain::EnsureSandboxInitialized(
236 gpu::GpuWatchdogThread* watchdog_thread) { 242 gpu::GpuWatchdogThread* watchdog_thread) {
237 // TODO(sad): https://crbug.com/645602 243 // TODO(sad): https://crbug.com/645602
238 return true; 244 return true;
239 } 245 }
240 246
241 } // namespace ui 247 } // namespace ui
OLDNEW
« no previous file with comments | « services/ui/gpu/gpu_main.h ('k') | services/ui/gpu/gpu_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698