diff options
author | alokp@chromium.org <alokp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-02 00:27:24 +0000 |
---|---|---|
committer | alokp@chromium.org <alokp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-02 00:27:24 +0000 |
commit | ec3b3007f6b9bc16ad961c3877cee142ef7e39b6 (patch) | |
tree | 2e4c34f33b40af47f33bd25b881905b3474fcea9 /chrome/browser/gpu_process_host.cc | |
parent | 1c51ab6df5c88c3200be14a2573410a60c3dc199 (diff) | |
download | chromium_src-ec3b3007f6b9bc16ad961c3877cee142ef7e39b6.zip chromium_src-ec3b3007f6b9bc16ad961c3877cee142ef7e39b6.tar.gz chromium_src-ec3b3007f6b9bc16ad961c3877cee142ef7e39b6.tar.bz2 |
Added a master switch to enable/disable gpu acceleration.
BUG=61771
Review URL: http://codereview.chromium.org/5334003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@67923 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/gpu_process_host.cc')
-rw-r--r-- | chrome/browser/gpu_process_host.cc | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/chrome/browser/gpu_process_host.cc b/chrome/browser/gpu_process_host.cc index 2cfc018..7c9d11c 100644 --- a/chrome/browser/gpu_process_host.cc +++ b/chrome/browser/gpu_process_host.cc @@ -14,6 +14,7 @@ #include "chrome/browser/renderer_host/render_view_host.h" #include "chrome/browser/renderer_host/render_widget_host_view.h" #include "chrome/browser/renderer_host/resource_message_filter.h" +#include "chrome/browser/tab_contents/render_view_host_delegate_helper.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/gpu_info.h" #include "chrome/common/gpu_messages.h" @@ -58,6 +59,12 @@ class RouteOnUIThreadTask : public Task { // initialized, the IO thread. static GpuProcessHost* sole_instance_ = NULL; +// Number of times the gpu process has crashed in the current browser session. +static int g_gpu_crash_count = 0; +// Maximum number of times the gpu process is allowed to crash in a session. +// Once this limit is reached, any request to launch the gpu process will fail. +static const int kGpuMaxCrashCount = 3; + void RouteOnUIThread(const IPC::Message& message) { BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, @@ -469,13 +476,15 @@ void GpuProcessHost::OnChildDied() { } void GpuProcessHost::OnProcessCrashed() { - // TODO(alokp): Update gpu process crash rate. + if (++g_gpu_crash_count >= kGpuMaxCrashCount) { + // The gpu process is too unstable to use. Disable it for current session. + RenderViewHostDelegateHelper::set_gpu_enabled(false); + } BrowserChildProcessHost::OnProcessCrashed(); } bool GpuProcessHost::CanLaunchGpuProcess() const { - // TODO(alokp): Answer based on crash rate. - return true; + return RenderViewHostDelegateHelper::gpu_enabled(); } bool GpuProcessHost::LaunchGpuProcess() { |