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

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

Issue 98603007: Launches a privileged utility process. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Resolves review feedback. Created 6 years, 10 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/browser/gpu/gpu_process_host.h" 5 #include "content/browser/gpu/gpu_process_host.h"
6 6
7 #include "base/base64.h" 7 #include "base/base64.h"
8 #include "base/base_switches.h" 8 #include "base/base_switches.h"
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 12 matching lines...) Expand all
23 #include "content/browser/renderer_host/render_widget_helper.h" 23 #include "content/browser/renderer_host/render_widget_helper.h"
24 #include "content/browser/renderer_host/render_widget_host_impl.h" 24 #include "content/browser/renderer_host/render_widget_host_impl.h"
25 #include "content/common/child_process_host_impl.h" 25 #include "content/common/child_process_host_impl.h"
26 #include "content/common/gpu/gpu_messages.h" 26 #include "content/common/gpu/gpu_messages.h"
27 #include "content/common/view_messages.h" 27 #include "content/common/view_messages.h"
28 #include "content/port/browser/render_widget_host_view_frame_subscriber.h" 28 #include "content/port/browser/render_widget_host_view_frame_subscriber.h"
29 #include "content/public/browser/browser_thread.h" 29 #include "content/public/browser/browser_thread.h"
30 #include "content/public/browser/content_browser_client.h" 30 #include "content/public/browser/content_browser_client.h"
31 #include "content/public/browser/render_process_host.h" 31 #include "content/public/browser/render_process_host.h"
32 #include "content/public/browser/render_widget_host_view.h" 32 #include "content/public/browser/render_widget_host_view.h"
33 #include "content/public/common/child_process_host_delegate.h"
33 #include "content/public/common/content_client.h" 34 #include "content/public/common/content_client.h"
34 #include "content/public/common/content_switches.h" 35 #include "content/public/common/content_switches.h"
35 #include "content/public/common/result_codes.h" 36 #include "content/public/common/result_codes.h"
36 #include "gpu/command_buffer/service/gpu_switches.h" 37 #include "gpu/command_buffer/service/gpu_switches.h"
37 #include "ipc/ipc_channel_handle.h" 38 #include "ipc/ipc_channel_handle.h"
38 #include "ipc/ipc_switches.h" 39 #include "ipc/ipc_switches.h"
39 #include "ui/events/latency_info.h" 40 #include "ui/events/latency_info.h"
40 #include "ui/gl/gl_switches.h" 41 #include "ui/gl/gl_switches.h"
41 42
42 43
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 BrowserThread::PostTask( 352 BrowserThread::PostTask(
352 BrowserThread::IO, 353 BrowserThread::IO,
353 FROM_HERE, 354 FROM_HERE,
354 base::Bind(&GpuProcessHost::GetProcessHandles, callback)); 355 base::Bind(&GpuProcessHost::GetProcessHandles, callback));
355 return; 356 return;
356 } 357 }
357 std::list<base::ProcessHandle> handles; 358 std::list<base::ProcessHandle> handles;
358 for (size_t i = 0; i < arraysize(g_gpu_process_hosts); ++i) { 359 for (size_t i = 0; i < arraysize(g_gpu_process_hosts); ++i) {
359 GpuProcessHost* host = g_gpu_process_hosts[i]; 360 GpuProcessHost* host = g_gpu_process_hosts[i];
360 if (host && ValidateHost(host)) 361 if (host && ValidateHost(host))
361 handles.push_back(host->process_->GetHandle()); 362 handles.push_back(
363 static_cast<ChildProcessHostDelegate*>(host->process_.get())->
364 GetHandle());
362 } 365 }
363 BrowserThread::PostTask( 366 BrowserThread::PostTask(
364 BrowserThread::UI, 367 BrowserThread::UI,
365 FROM_HERE, 368 FROM_HERE,
366 base::Bind(callback, handles)); 369 base::Bind(callback, handles));
367 } 370 }
368 371
369 // static 372 // static
370 void GpuProcessHost::SendOnIO(GpuProcessKind kind, 373 void GpuProcessHost::SendOnIO(GpuProcessKind kind,
371 CauseForGpuLaunch cause, 374 CauseForGpuLaunch cause,
(...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after
1166 UMA_HISTOGRAM_BOOLEAN("GPU.GPU.GPUProcessSoftwareRendering", 1169 UMA_HISTOGRAM_BOOLEAN("GPU.GPU.GPUProcessSoftwareRendering",
1167 swiftshader_rendering_); 1170 swiftshader_rendering_);
1168 1171
1169 // If specified, prepend a launcher program to the command line. 1172 // If specified, prepend a launcher program to the command line.
1170 if (!gpu_launcher.empty()) 1173 if (!gpu_launcher.empty())
1171 cmd_line->PrependWrapper(gpu_launcher); 1174 cmd_line->PrependWrapper(gpu_launcher);
1172 1175
1173 process_->Launch( 1176 process_->Launch(
1174 #if defined(OS_WIN) 1177 #if defined(OS_WIN)
1175 new GpuSandboxedProcessLauncherDelegate(cmd_line), 1178 new GpuSandboxedProcessLauncherDelegate(cmd_line),
1179 false,
1176 #elif defined(OS_POSIX) 1180 #elif defined(OS_POSIX)
1177 false, 1181 false,
1178 base::EnvironmentMap(), 1182 base::EnvironmentMap(),
1179 #endif 1183 #endif
1180 cmd_line); 1184 cmd_line);
1181 process_launched_ = true; 1185 process_launched_ = true;
1182 1186
1183 UMA_HISTOGRAM_ENUMERATION("GPU.GPUProcessLifetimeEvents", 1187 UMA_HISTOGRAM_ENUMERATION("GPU.GPUProcessLifetimeEvents",
1184 LAUNCHED, GPU_PROCESS_LIFETIME_EVENT_MAX); 1188 LAUNCHED, GPU_PROCESS_LIFETIME_EVENT_MAX);
1185 return true; 1189 return true;
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
1256 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader"); 1260 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader");
1257 ClientIdToShaderCacheMap::iterator iter = 1261 ClientIdToShaderCacheMap::iterator iter =
1258 client_id_to_shader_cache_.find(client_id); 1262 client_id_to_shader_cache_.find(client_id);
1259 // If the cache doesn't exist then this is an off the record profile. 1263 // If the cache doesn't exist then this is an off the record profile.
1260 if (iter == client_id_to_shader_cache_.end()) 1264 if (iter == client_id_to_shader_cache_.end())
1261 return; 1265 return;
1262 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader); 1266 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader);
1263 } 1267 }
1264 1268
1265 } // namespace content 1269 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698