Chromium Code Reviews| Index: chrome/browser/gpu_process_host.cc |
| =================================================================== |
| --- chrome/browser/gpu_process_host.cc (revision 71359) |
| +++ chrome/browser/gpu_process_host.cc (working copy) |
| @@ -574,6 +574,12 @@ |
| bool GpuProcessHost::LaunchGpuProcess() { |
| const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); |
| + // TODO(apatrick): glib is not thread safe and the GPU thread needs to pump |
| + // the message loop for the CPU child window. A long-term fix might be to make |
|
jonathan.backer
2011/01/14 19:30:30
I don't think that we need to run a UI thread for
|
| + // the browser process responsible for presenting frames and eliminate the |
| + // GPU child window so the GPU thread can run in the browser process. |
|
jonathan.backer
2011/01/14 19:30:30
The way that the code currently works (it has chan
|
| +#if !defined(OS_LINUX) |
| + |
| // If the single-process switch is present, just launch the GPU service in a |
| // new thread in the browser process. |
| if (browser_command_line.HasSwitch(switches::kSingleProcess)) { |
| @@ -584,50 +590,53 @@ |
| if (!thread->StartWithOptions(options)) |
| return false; |
| - } else { |
| - CommandLine::StringType gpu_launcher = |
| - browser_command_line.GetSwitchValueNative(switches::kGpuLauncher); |
| - FilePath exe_path = ChildProcessHost::GetChildPath(gpu_launcher.empty()); |
| - if (exe_path.empty()) |
| - return false; |
| + return true; |
| + } |
| +#endif |
| - CommandLine* cmd_line = new CommandLine(exe_path); |
| - cmd_line->AppendSwitchASCII(switches::kProcessType, switches::kGpuProcess); |
| - cmd_line->AppendSwitchASCII(switches::kProcessChannelID, channel_id()); |
| + CommandLine::StringType gpu_launcher = |
| + browser_command_line.GetSwitchValueNative(switches::kGpuLauncher); |
| - // Propagate relevant command line switches. |
| - static const char* const kSwitchNames[] = { |
| - switches::kUseGL, |
| - switches::kDisableGpuVsync, |
| - switches::kDisableGpuWatchdog, |
| - switches::kDisableLogging, |
| - switches::kEnableAcceleratedDecoding, |
| - switches::kEnableLogging, |
| - #if defined(OS_MACOSX) |
| - switches::kEnableSandboxLogging, |
| - #endif |
| - switches::kGpuStartupDialog, |
| - switches::kLoggingLevel, |
| - switches::kNoGpuSandbox, |
| - switches::kNoSandbox, |
| - }; |
| - cmd_line->CopySwitchesFrom(browser_command_line, kSwitchNames, |
| - arraysize(kSwitchNames)); |
| + FilePath exe_path = ChildProcessHost::GetChildPath(gpu_launcher.empty()); |
| + if (exe_path.empty()) |
| + return false; |
| - // If specified, prepend a launcher program to the command line. |
| - if (!gpu_launcher.empty()) |
| - cmd_line->PrependWrapper(gpu_launcher); |
| + CommandLine* cmd_line = new CommandLine(exe_path); |
| + cmd_line->AppendSwitchASCII(switches::kProcessType, switches::kGpuProcess); |
| + cmd_line->AppendSwitchASCII(switches::kProcessChannelID, channel_id()); |
| - Launch( |
| + // Propagate relevant command line switches. |
| + static const char* const kSwitchNames[] = { |
| + switches::kUseGL, |
| + switches::kDisableGpuVsync, |
| + switches::kDisableGpuWatchdog, |
| + switches::kDisableLogging, |
| + switches::kEnableAcceleratedDecoding, |
| + switches::kEnableLogging, |
| +#if defined(OS_MACOSX) |
| + switches::kEnableSandboxLogging, |
| +#endif |
| + switches::kGpuStartupDialog, |
| + switches::kLoggingLevel, |
| + switches::kNoGpuSandbox, |
| + switches::kNoSandbox, |
| + }; |
| + cmd_line->CopySwitchesFrom(browser_command_line, kSwitchNames, |
| + arraysize(kSwitchNames)); |
| + |
| + // If specified, prepend a launcher program to the command line. |
| + if (!gpu_launcher.empty()) |
| + cmd_line->PrependWrapper(gpu_launcher); |
| + |
| + Launch( |
| #if defined(OS_WIN) |
| - FilePath(), |
| + FilePath(), |
| #elif defined(OS_POSIX) |
| - false, // Never use the zygote (GPU plugin can't be sandboxed). |
| - base::environment_vector(), |
| + false, // Never use the zygote (GPU plugin can't be sandboxed). |
| + base::environment_vector(), |
| #endif |
| - cmd_line); |
| - } |
| + cmd_line); |
| UMA_HISTOGRAM_ENUMERATION("GPU.GPUProcessLifetimeEvents", |
| LAUNCED, GPU_PROCESS_LIFETIME_EVENT_MAX); |