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

Unified Diff: content/browser/gpu/gpu_process_host.cc

Issue 9559013: Refactor GpuProcessHost::GetForClient to GpuProcessHost::Get, which takes a GPU process kind rather… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 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 side-by-side diff with in-line comments
Download patch
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::Kind 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(Kind kind,
+ content::CauseForGpuLaunch cause) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
// Don't grant further access to GPU if it is not allowed.
@@ -203,7 +203,7 @@
!it.IsAtEnd(); it.Advance()) {
GpuProcessHost* host = it.GetCurrentValue();
- if (host->sandboxed() != (client_id != 0))
+ if (host->kind() != kind)
continue;
if (HostIsValid(host))
@@ -220,7 +220,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 +229,13 @@
}
// static
-void GpuProcessHost::SendOnIO(int client_id,
+void GpuProcessHost::SendOnIO(Kind 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 +252,12 @@
return NULL;
}
-GpuProcessHost::GpuProcessHost(int host_id, bool sandboxed)
+GpuProcessHost::GpuProcessHost(int host_id, Kind 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 +290,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_ == kSandboxed) {
if (software_rendering_) {
if (++g_gpu_software_crash_count >= kGpuMaxCrashCount) {
// The software renderer is too unstable to use. Disable it for current
@@ -533,7 +533,7 @@
params.size,
params.surface_handle,
base::Bind(SendOnIO,
- host_id_,
+ GpuProcessHost::kSandboxed,
content::CAUSE_FOR_GPU_LAUNCH_NO_LAUNCH,
new AcceleratedSurfaceMsg_BuffersSwappedACK(
params.route_id)));
@@ -578,8 +578,8 @@
return software_rendering_;
}
-bool GpuProcessHost::sandboxed() {
- return sandboxed_;
+GpuProcessHost::Kind GpuProcessHost::kind() {
+ return kind_;
}
void GpuProcessHost::ForceShutdown() {
@@ -615,7 +615,7 @@
cmd_line->AppendSwitchASCII(switches::kProcessType, switches::kGpuProcess);
cmd_line->AppendSwitchASCII(switches::kProcessChannelID, channel_id);
- if (!sandboxed_)
+ if (kind_ == kUnsandboxed)
cmd_line->AppendSwitch(switches::kDisableGpuSandbox);
// Propagate relevant command line switches.

Powered by Google App Engine
This is Rietveld 408576698