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

Side by Side Diff: content/browser/gpu/gpu_process_host.cc

Issue 2459973002: Expedite discovery of primary DRM device. (Closed)
Patch Set: Send the first AddGraphicsDevice IPC synchronously on IO thread. 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) 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/browser/gpu/gpu_process_host.h" 5 #include "content/browser/gpu/gpu_process_host.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <list> 10 #include <list>
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 75
76 #if defined(OS_WIN) 76 #if defined(OS_WIN)
77 #include "base/win/windows_version.h" 77 #include "base/win/windows_version.h"
78 #include "content/common/sandbox_win.h" 78 #include "content/common/sandbox_win.h"
79 #include "sandbox/win/src/sandbox_policy.h" 79 #include "sandbox/win/src/sandbox_policy.h"
80 #include "ui/gfx/switches.h" 80 #include "ui/gfx/switches.h"
81 #include "ui/gfx/win/rendering_window_manager.h" 81 #include "ui/gfx/win/rendering_window_manager.h"
82 #endif 82 #endif
83 83
84 #if defined(USE_OZONE) 84 #if defined(USE_OZONE)
85 #include "ui/ozone/public/gpu_platform_support_host.h"
86 #include "ui/ozone/public/ozone_platform.h"
85 #include "ui/ozone/public/ozone_switches.h" 87 #include "ui/ozone/public/ozone_switches.h"
86 #endif 88 #endif
87 89
88 #if defined(USE_X11) && !defined(OS_CHROMEOS) 90 #if defined(USE_X11) && !defined(OS_CHROMEOS)
89 #include "ui/gfx/x/x11_switches.h" // nogncheck 91 #include "ui/gfx/x/x11_switches.h" // nogncheck
90 #endif 92 #endif
91 93
92 #if defined(OS_MACOSX) || defined(OS_ANDROID) 94 #if defined(OS_MACOSX) || defined(OS_ANDROID)
93 #include "gpu/ipc/common/gpu_surface_tracker.h" 95 #include "gpu/ipc/common/gpu_surface_tracker.h"
94 #endif 96 #endif
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 bool force_create, 180 bool force_create,
179 IPC::Message* message) { 181 IPC::Message* message) {
180 GpuProcessHost* host = GpuProcessHost::Get(kind, force_create); 182 GpuProcessHost* host = GpuProcessHost::Get(kind, force_create);
181 if (host) { 183 if (host) {
182 host->Send(message); 184 host->Send(message);
183 } else { 185 } else {
184 delete message; 186 delete message;
185 } 187 }
186 } 188 }
187 189
190 #if defined(USE_OZONE)
191 void SendGpuProcessMessageByHostId(int host_id, IPC::Message* message) {
192 GpuProcessHost* host = GpuProcessHost::FromID(host_id);
193 if (host) {
194 host->Send(message);
195 } else {
196 delete message;
197 }
198 }
199 #endif
200
188 // NOTE: changes to this class need to be reviewed by the security team. 201 // NOTE: changes to this class need to be reviewed by the security team.
189 class GpuSandboxedProcessLauncherDelegate 202 class GpuSandboxedProcessLauncherDelegate
190 : public SandboxedProcessLauncherDelegate { 203 : public SandboxedProcessLauncherDelegate {
191 public: 204 public:
192 GpuSandboxedProcessLauncherDelegate(base::CommandLine* cmd_line, 205 GpuSandboxedProcessLauncherDelegate(base::CommandLine* cmd_line,
193 ChildProcessHost* host) 206 ChildProcessHost* host)
194 #if defined(OS_WIN) 207 #if defined(OS_WIN)
195 : cmd_line_(cmd_line) {} 208 : cmd_line_(cmd_line) {}
196 #elif defined(OS_POSIX) 209 #elif defined(OS_POSIX)
197 : ipc_fd_(host->TakeClientFileDescriptor()) {} 210 : ipc_fd_(host->TakeClientFileDescriptor()) {}
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
589 in_process_gpu_thread_->StartWithOptions(options); 602 in_process_gpu_thread_->StartWithOptions(options);
590 603
591 OnProcessLaunched(); // Fake a callback that the process is ready. 604 OnProcessLaunched(); // Fake a callback that the process is ready.
592 } else if (!LaunchGpuProcess(&gpu_preferences)) { 605 } else if (!LaunchGpuProcess(&gpu_preferences)) {
593 return false; 606 return false;
594 } 607 }
595 608
596 if (!Send(new GpuMsg_Initialize(gpu_preferences))) 609 if (!Send(new GpuMsg_Initialize(gpu_preferences)))
597 return false; 610 return false;
598 611
612 #if defined(USE_OZONE)
613 ui::OzonePlatform::GetInstance()
dnicoara 2016/11/01 19:00:40 Is this guaranteed to run before GpuProcessHostUiS
hshi1 2016/11/01 19:06:00 Yes because GpuProcessHostUiShim::Create() is post
614 ->GetGpuPlatformSupportHost()
615 ->OnGpuProcessLaunched(
616 host_id_, BrowserThread::GetTaskRunnerForThread(BrowserThread::IO),
617 base::Bind(&SendGpuProcessMessageByHostId, host_id_));
618 #endif
619
599 return true; 620 return true;
600 } 621 }
601 622
602 void GpuProcessHost::RouteOnUIThread(const IPC::Message& message) { 623 void GpuProcessHost::RouteOnUIThread(const IPC::Message& message) {
603 BrowserThread::PostTask( 624 BrowserThread::PostTask(
604 BrowserThread::UI, 625 BrowserThread::UI,
605 FROM_HERE, 626 FROM_HERE,
606 base::Bind(&RouteToGpuProcessHostUIShimTask, host_id_, message)); 627 base::Bind(&RouteToGpuProcessHostUIShimTask, host_id_, message));
607 } 628 }
608 629
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after
1166 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader"); 1187 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader");
1167 ClientIdToShaderCacheMap::iterator iter = 1188 ClientIdToShaderCacheMap::iterator iter =
1168 client_id_to_shader_cache_.find(client_id); 1189 client_id_to_shader_cache_.find(client_id);
1169 // If the cache doesn't exist then this is an off the record profile. 1190 // If the cache doesn't exist then this is an off the record profile.
1170 if (iter == client_id_to_shader_cache_.end()) 1191 if (iter == client_id_to_shader_cache_.end())
1171 return; 1192 return;
1172 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader); 1193 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader);
1173 } 1194 }
1174 1195
1175 } // namespace content 1196 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698