Index: content/browser/gpu/gpu_process_host.cc |
=================================================================== |
--- content/browser/gpu/gpu_process_host.cc (revision 123977) |
+++ content/browser/gpu/gpu_process_host.cc (working copy) |
@@ -79,10 +79,10 @@ |
#endif |
-void SendGpuProcessMessage(int client_id, |
+void SendGpuProcessMessage(GpuProcessHost::GpuProcessKind kind, |
content::CauseForGpuLaunch cause, |
IPC::Message* message) { |
- GpuProcessHost* host = GpuProcessHost::GetForClient(client_id, cause); |
+ GpuProcessHost* host = GpuProcessHost::Get(kind, cause); |
if (host) { |
host->Send(message); |
} else { |
@@ -187,8 +187,8 @@ |
} |
// static |
-GpuProcessHost* GpuProcessHost::GetForClient( |
- int client_id, content::CauseForGpuLaunch cause) { |
+GpuProcessHost* GpuProcessHost::Get(GpuProcessKind kind, |
+ content::CauseForGpuLaunch cause) { |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
// Don't grant further access to GPU if it is not allowed. |
@@ -196,14 +196,11 @@ |
if (gpu_data_manager != NULL && !gpu_data_manager->GpuAccessAllowed()) |
return NULL; |
- // The current policy is to ignore the renderer ID and use a single GPU |
- // process (the first valid host in the host-id map) for all renderers. Later |
- // this will be extended to allow the use of multiple GPU processes. |
for (IDMap<GpuProcessHost>::iterator it(g_hosts_by_id.Pointer()); |
Ami GONE FROM CHROMIUM
2012/03/01 03:21:03
Add a TODO to clean this up? (with a flame-thrower
|
!it.IsAtEnd(); it.Advance()) { |
GpuProcessHost* host = it.GetCurrentValue(); |
- if (host->sandboxed() != (client_id != 0)) |
+ if (host->kind() != kind) |
continue; |
if (HostIsValid(host)) |
@@ -220,7 +217,7 @@ |
cause, |
content::CAUSE_FOR_GPU_LAUNCH_MAX_ENUM); |
- GpuProcessHost* host = new GpuProcessHost(host_id, client_id != 0); |
+ GpuProcessHost* host = new GpuProcessHost(host_id, kind); |
if (host->Init()) |
return host; |
@@ -229,13 +226,13 @@ |
} |
// static |
-void GpuProcessHost::SendOnIO(int client_id, |
+void GpuProcessHost::SendOnIO(GpuProcessKind kind, |
content::CauseForGpuLaunch cause, |
IPC::Message* message) { |
BrowserThread::PostTask( |
BrowserThread::IO, FROM_HERE, |
base::Bind( |
- &SendGpuProcessMessage, client_id, cause, message)); |
+ &SendGpuProcessMessage, kind, cause, message)); |
} |
// static |
@@ -252,12 +249,12 @@ |
return NULL; |
} |
-GpuProcessHost::GpuProcessHost(int host_id, bool sandboxed) |
+GpuProcessHost::GpuProcessHost(int host_id, GpuProcessKind kind) |
: host_id_(host_id), |
gpu_process_(base::kNullProcessHandle), |
in_process_(false), |
software_rendering_(false), |
- sandboxed_(sandboxed), |
+ kind_(kind), |
process_launched_(false) { |
if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess) || |
CommandLine::ForCurrentProcess()->HasSwitch(switches::kInProcessGPU)) |
@@ -290,7 +287,7 @@ |
// Ending only acts as a failure if the GPU process was actually started and |
// was intended for actual rendering (and not just checking caps or other |
// options). |
- if (process_launched_ && sandboxed_) { |
+ if (process_launched_ && kind_ == GPU_PROCESS_KIND_SANDBOXED) { |
if (software_rendering_) { |
if (++g_gpu_software_crash_count >= kGpuMaxCrashCount) { |
// The software renderer is too unstable to use. Disable it for current |
@@ -533,7 +530,7 @@ |
params.size, |
params.surface_handle, |
base::Bind(SendOnIO, |
- host_id_, |
+ GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED, |
content::CAUSE_FOR_GPU_LAUNCH_NO_LAUNCH, |
new AcceleratedSurfaceMsg_BuffersSwappedACK( |
params.route_id))); |
@@ -578,8 +575,8 @@ |
return software_rendering_; |
} |
-bool GpuProcessHost::sandboxed() { |
- return sandboxed_; |
+GpuProcessHost::GpuProcessKind GpuProcessHost::kind() { |
+ return kind_; |
} |
void GpuProcessHost::ForceShutdown() { |
@@ -615,7 +612,7 @@ |
cmd_line->AppendSwitchASCII(switches::kProcessType, switches::kGpuProcess); |
cmd_line->AppendSwitchASCII(switches::kProcessChannelID, channel_id); |
- if (!sandboxed_) |
+ if (kind_ == GPU_PROCESS_KIND_UNSANDBOXED) |
cmd_line->AppendSwitch(switches::kDisableGpuSandbox); |
// Propagate relevant command line switches. |