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 "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 } | 488 } |
489 | 489 |
490 void GpuProcessHost::OnChildDied() { | 490 void GpuProcessHost::OnChildDied() { |
491 // Located in OnChildDied because OnProcessCrashed suffers from a race | 491 // Located in OnChildDied because OnProcessCrashed suffers from a race |
492 // condition on Linux. The GPU process will only die if it crashes. | 492 // condition on Linux. The GPU process will only die if it crashes. |
493 UMA_HISTOGRAM_ENUMERATION("GPU.GPUProcessLifetimeEvents", | 493 UMA_HISTOGRAM_ENUMERATION("GPU.GPUProcessLifetimeEvents", |
494 kCrashed, kGPUProcessLifetimeEvent_Max); | 494 kCrashed, kGPUProcessLifetimeEvent_Max); |
495 BrowserChildProcessHost::OnChildDied(); | 495 BrowserChildProcessHost::OnChildDied(); |
496 } | 496 } |
497 | 497 |
498 void GpuProcessHost::OnProcessCrashed() { | 498 void GpuProcessHost::OnProcessCrashed(int exit_code) { |
499 if (++g_gpu_crash_count >= kGpuMaxCrashCount) { | 499 if (++g_gpu_crash_count >= kGpuMaxCrashCount) { |
500 // The gpu process is too unstable to use. Disable it for current session. | 500 // The gpu process is too unstable to use. Disable it for current session. |
501 RenderViewHostDelegateHelper::set_gpu_enabled(false); | 501 RenderViewHostDelegateHelper::set_gpu_enabled(false); |
502 } | 502 } |
503 BrowserChildProcessHost::OnProcessCrashed(); | 503 BrowserChildProcessHost::OnProcessCrashed(exit_code); |
504 } | 504 } |
505 | 505 |
506 bool GpuProcessHost::CanLaunchGpuProcess() const { | 506 bool GpuProcessHost::CanLaunchGpuProcess() const { |
507 return RenderViewHostDelegateHelper::gpu_enabled(); | 507 return RenderViewHostDelegateHelper::gpu_enabled(); |
508 } | 508 } |
509 | 509 |
510 bool GpuProcessHost::LaunchGpuProcess() { | 510 bool GpuProcessHost::LaunchGpuProcess() { |
511 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); | 511 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); |
512 CommandLine::StringType gpu_launcher = | 512 CommandLine::StringType gpu_launcher = |
513 browser_command_line.GetSwitchValueNative(switches::kGpuLauncher); | 513 browser_command_line.GetSwitchValueNative(switches::kGpuLauncher); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
567 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); | 567 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); |
568 if (browser_command_line.HasSwitch(switches::kIgnoreGpuBlacklist) || | 568 if (browser_command_line.HasSwitch(switches::kIgnoreGpuBlacklist) || |
569 blacklist->LoadGpuBlacklist(gpu_blacklist_json.as_string(), true)) { | 569 blacklist->LoadGpuBlacklist(gpu_blacklist_json.as_string(), true)) { |
570 gpu_blacklist_.reset(blacklist); | 570 gpu_blacklist_.reset(blacklist); |
571 return true; | 571 return true; |
572 } | 572 } |
573 delete blacklist; | 573 delete blacklist; |
574 return false; | 574 return false; |
575 } | 575 } |
576 | 576 |
OLD | NEW |