Chromium Code Reviews

Unified Diff: chrome/browser/gpu_process_host.cc

Issue 5334003: Added a master switch to enable/disable gpu acceleration. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
« no previous file with comments | « no previous file | chrome/browser/tab_contents/render_view_host_delegate_helper.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/gpu_process_host.cc
===================================================================
--- chrome/browser/gpu_process_host.cc (revision 67133)
+++ chrome/browser/gpu_process_host.cc (working copy)
@@ -13,6 +13,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"
@@ -48,6 +49,12 @@
// 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;
+// Maximaum number of times the gpu process is allowed to crash in a session.
apatrick_chromium 2010/11/29 20:59:31 typo: Maximum
+// 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,
@@ -344,13 +351,15 @@
}
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() {
apatrick 2010/11/29 17:45:38 Does making this function return false when g_gpu_
alokp 2010/11/29 18:34:38 yes it works and I do that too via CanLaunchGpuPro
« no previous file with comments | « no previous file | chrome/browser/tab_contents/render_view_host_delegate_helper.h » ('j') | no next file with comments »

Powered by Google App Engine