| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/gpu_process_host.h" | 5 #include "chrome/browser/gpu_process_host.h" |
| 6 | 6 |
| 7 #include "app/app_switches.h" | 7 #include "app/app_switches.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/thread.h" | 10 #include "base/thread.h" |
| (...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 468 } | 468 } |
| 469 | 469 |
| 470 void GpuProcessHost::OnChildDied() { | 470 void GpuProcessHost::OnChildDied() { |
| 471 // Located in OnChildDied because OnProcessCrashed suffers from a race | 471 // Located in OnChildDied because OnProcessCrashed suffers from a race |
| 472 // condition on Linux. The GPU process will only die if it crashes. | 472 // condition on Linux. The GPU process will only die if it crashes. |
| 473 UMA_HISTOGRAM_ENUMERATION("GPU.GPUProcessLifetimeEvents", | 473 UMA_HISTOGRAM_ENUMERATION("GPU.GPUProcessLifetimeEvents", |
| 474 kCrashed, kGPUProcessLifetimeEvent_Max); | 474 kCrashed, kGPUProcessLifetimeEvent_Max); |
| 475 BrowserChildProcessHost::OnChildDied(); | 475 BrowserChildProcessHost::OnChildDied(); |
| 476 } | 476 } |
| 477 | 477 |
| 478 void GpuProcessHost::OnProcessCrashed() { | 478 void GpuProcessHost::OnProcessCrashed(int exit_code) { |
| 479 if (++g_gpu_crash_count >= kGpuMaxCrashCount) { | 479 if (++g_gpu_crash_count >= kGpuMaxCrashCount) { |
| 480 // The gpu process is too unstable to use. Disable it for current session. | 480 // The gpu process is too unstable to use. Disable it for current session. |
| 481 RenderViewHostDelegateHelper::set_gpu_enabled(false); | 481 RenderViewHostDelegateHelper::set_gpu_enabled(false); |
| 482 } | 482 } |
| 483 BrowserChildProcessHost::OnProcessCrashed(); | 483 BrowserChildProcessHost::OnProcessCrashed(exit_code); |
| 484 } | 484 } |
| 485 | 485 |
| 486 bool GpuProcessHost::CanLaunchGpuProcess() const { | 486 bool GpuProcessHost::CanLaunchGpuProcess() const { |
| 487 return RenderViewHostDelegateHelper::gpu_enabled(); | 487 return RenderViewHostDelegateHelper::gpu_enabled(); |
| 488 } | 488 } |
| 489 | 489 |
| 490 bool GpuProcessHost::LaunchGpuProcess() { | 490 bool GpuProcessHost::LaunchGpuProcess() { |
| 491 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); | 491 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); |
| 492 CommandLine::StringType gpu_launcher = | 492 CommandLine::StringType gpu_launcher = |
| 493 browser_command_line.GetSwitchValueNative(switches::kGpuLauncher); | 493 browser_command_line.GetSwitchValueNative(switches::kGpuLauncher); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 529 #elif defined(OS_POSIX) | 529 #elif defined(OS_POSIX) |
| 530 false, // Never use the zygote (GPU plugin can't be sandboxed). | 530 false, // Never use the zygote (GPU plugin can't be sandboxed). |
| 531 base::environment_vector(), | 531 base::environment_vector(), |
| 532 #endif | 532 #endif |
| 533 cmd_line); | 533 cmd_line); |
| 534 | 534 |
| 535 UMA_HISTOGRAM_ENUMERATION("GPU.GPUProcessLifetimeEvents", | 535 UMA_HISTOGRAM_ENUMERATION("GPU.GPUProcessLifetimeEvents", |
| 536 kLaunched, kGPUProcessLifetimeEvent_Max); | 536 kLaunched, kGPUProcessLifetimeEvent_Max); |
| 537 return true; | 537 return true; |
| 538 } | 538 } |
| 539 | |
| OLD | NEW |