Chromium Code Reviews| Index: content/browser/gpu/gpu_process_host.cc |
| diff --git a/content/browser/gpu/gpu_process_host.cc b/content/browser/gpu/gpu_process_host.cc |
| index f123addefee525e1206fddb3d5822821e2b6a621..401dedcc2f20b56c5cb38a3467055c14face65ce 100644 |
| --- a/content/browser/gpu/gpu_process_host.cc |
| +++ b/content/browser/gpu/gpu_process_host.cc |
| @@ -68,6 +68,11 @@ namespace content { |
| bool GpuProcessHost::gpu_enabled_ = true; |
| bool GpuProcessHost::hardware_gpu_enabled_ = true; |
| +int GpuProcessHost::gpu_crash_count_ = 0; |
| +int GpuProcessHost::gpu_recent_crash_count_ = 0; |
| +base::Time GpuProcessHost::last_gpu_crash_time_; |
|
Ken Russell (switch to Gerrit)
2014/07/25 21:21:36
We need to ensure that this doesn't add any static
|
| +bool GpuProcessHost::crashed_before_ = false; |
| +int GpuProcessHost::swiftshader_crash_count_ = 0; |
| namespace { |
| @@ -366,13 +371,6 @@ GpuProcessHost::~GpuProcessHost() { |
| // fail. |
| const int kGpuMaxCrashCount = 3; |
| - // Number of times the gpu process has crashed in the current browser session. |
| - static int gpu_crash_count = 0; |
| - static int gpu_recent_crash_count = 0; |
| - static base::Time last_gpu_crash_time; |
| - static bool crashed_before = false; |
| - static int swiftshader_crash_count = 0; |
| - |
| bool disable_crash_limit = CommandLine::ForCurrentProcess()->HasSwitch( |
| switches::kDisableGpuProcessCrashLimit); |
| @@ -382,37 +380,38 @@ GpuProcessHost::~GpuProcessHost() { |
| if (process_launched_ && kind_ == GPU_PROCESS_KIND_SANDBOXED) { |
| if (swiftshader_rendering_) { |
| UMA_HISTOGRAM_ENUMERATION("GPU.SwiftShaderLifetimeEvents", |
| - DIED_FIRST_TIME + swiftshader_crash_count, |
| + DIED_FIRST_TIME + swiftshader_crash_count_, |
| GPU_PROCESS_LIFETIME_EVENT_MAX); |
| - if (++swiftshader_crash_count >= kGpuMaxCrashCount && |
| + if (++swiftshader_crash_count_ >= kGpuMaxCrashCount && |
| !disable_crash_limit) { |
| // SwiftShader is too unstable to use. Disable it for current session. |
| gpu_enabled_ = false; |
| } |
| } else { |
| - ++gpu_crash_count; |
| + ++gpu_crash_count_; |
| UMA_HISTOGRAM_ENUMERATION("GPU.GPUProcessLifetimeEvents", |
| - std::min(DIED_FIRST_TIME + gpu_crash_count, |
| + std::min(DIED_FIRST_TIME + gpu_crash_count_, |
| GPU_PROCESS_LIFETIME_EVENT_MAX - 1), |
| GPU_PROCESS_LIFETIME_EVENT_MAX); |
| // Allow about 1 GPU crash per hour to be removed from the crash count, |
| // so very occasional crashes won't eventually add up and prevent the |
| // GPU process from launching. |
| - ++gpu_recent_crash_count; |
| + ++gpu_recent_crash_count_; |
| base::Time current_time = base::Time::Now(); |
| - if (crashed_before) { |
| - int hours_different = (current_time - last_gpu_crash_time).InHours(); |
| - gpu_recent_crash_count = |
| - std::max(0, gpu_recent_crash_count - hours_different); |
| + if (crashed_before_) { |
| + int hours_different = (current_time - last_gpu_crash_time_).InHours(); |
| + gpu_recent_crash_count_ = |
| + std::max(0, gpu_recent_crash_count_ - hours_different); |
| } |
| - crashed_before = true; |
| - last_gpu_crash_time = current_time; |
| + crashed_before_ = true; |
| + last_gpu_crash_time_ = current_time; |
| - if ((gpu_recent_crash_count >= kGpuMaxCrashCount && !disable_crash_limit) |
| - || !initialized_) { |
| + if ((gpu_recent_crash_count_ >= kGpuMaxCrashCount && |
| + !disable_crash_limit) || |
| + !initialized_) { |
| #if !defined(OS_CHROMEOS) |
| // The gpu process is too unstable to use. Disable it for current |
| // session. |