diff options
author | amarinichev@chromium.org <amarinichev@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-01 20:14:16 +0000 |
---|---|---|
committer | amarinichev@chromium.org <amarinichev@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-01 20:14:16 +0000 |
commit | 2ddda60fef1c98a592d9d979ff91e339e3c58869 (patch) | |
tree | c6c219888decf0514265e60f936b0cd65396334a /content | |
parent | 2e0735d7aedb3d42b4d2953d504fe8fa84cdfc27 (diff) | |
download | chromium_src-2ddda60fef1c98a592d9d979ff91e339e3c58869.zip chromium_src-2ddda60fef1c98a592d9d979ff91e339e3c58869.tar.gz chromium_src-2ddda60fef1c98a592d9d979ff91e339e3c58869.tar.bz2 |
Better handling of disabling the GPU acceleration if the GPU process dies more than 3 times.
* Because of bug 63531 (Mac and Linux), we were not counting how many times the GPU process crashes correctly. Moved counting from GpuProcessHost::OnProcessCrashed to GpuProcessHost::OnChildDied.
* If initialization of the GPU host fails for any reason, GpuProcessHostUIShim::SendOutstandingReplies sets the process ID to zero. Handle that case correctly in RenderThread::OnGpuChannelEstablished.
* GpuProcessHost::Init would return false if GPU support is disabled. Make sure that pending replies are sent.
BUG=none
TEST=load the 3D poster circle page, open another window and go to about:gpucrash three times. The animation will disappear (anoter bug!), but at least the tab will still be alive.
Review URL: http://codereview.chromium.org/6731057
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@80208 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r-- | content/browser/gpu_process_host.cc | 14 | ||||
-rw-r--r-- | content/browser/gpu_process_host.h | 1 | ||||
-rw-r--r-- | content/browser/renderer_host/gpu_message_filter.cc | 28 |
3 files changed, 22 insertions, 21 deletions
diff --git a/content/browser/gpu_process_host.cc b/content/browser/gpu_process_host.cc index 8eda823..053ca2f 100644 --- a/content/browser/gpu_process_host.cc +++ b/content/browser/gpu_process_host.cc @@ -98,9 +98,6 @@ bool GpuProcessHost::Init() { if (!CreateChannel()) return false; - if (!CanLaunchGpuProcess()) - return false; - if (!LaunchGpuProcess()) return false; @@ -189,13 +186,14 @@ void GpuProcessHost::OnProcessCrashed(int exit_code) { BrowserChildProcessHost::OnProcessCrashed(exit_code); } -bool GpuProcessHost::CanLaunchGpuProcess() const { - return RenderViewHostDelegateHelper::gpu_enabled(); -} - bool GpuProcessHost::LaunchGpuProcess() { - if (g_gpu_crash_count >= kGpuMaxCrashCount) + if (!RenderViewHostDelegateHelper::gpu_enabled() || + g_gpu_crash_count >= kGpuMaxCrashCount) + { + SendOutstandingReplies(host_id_); + RenderViewHostDelegateHelper::set_gpu_enabled(false); return false; + } const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); diff --git a/content/browser/gpu_process_host.h b/content/browser/gpu_process_host.h index 9106b83..7058046 100644 --- a/content/browser/gpu_process_host.h +++ b/content/browser/gpu_process_host.h @@ -48,7 +48,6 @@ class GpuProcessHost : public BrowserChildProcessHost, virtual void OnChildDied(); virtual void OnProcessCrashed(int exit_code); - bool CanLaunchGpuProcess() const; bool LaunchGpuProcess(); // The serial number of the GpuProcessHost / GpuProcessHostUIShim pair. diff --git a/content/browser/renderer_host/gpu_message_filter.cc b/content/browser/renderer_host/gpu_message_filter.cc index 87d2362..5d46260 100644 --- a/content/browser/renderer_host/gpu_message_filter.cc +++ b/content/browser/renderer_host/gpu_message_filter.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -70,25 +70,29 @@ class EstablishChannelCallback } void Send(const IPC::ChannelHandle& channel, - base::ProcessHandle gou_process_for_browser, + base::ProcessHandle gpu_process_for_browser, const GPUInfo& gpu_info) { if (!filter_) return; base::ProcessHandle renderer_process_for_gpu; + if (gpu_process_for_browser != 0) { #if defined(OS_WIN) - // Create a process handle that the renderer process can give to the GPU - // process to give it access to its handles. - DuplicateHandle(base::GetCurrentProcessHandle(), - filter_->peer_handle(), - gou_process_for_browser, - &renderer_process_for_gpu, - PROCESS_DUP_HANDLE, - FALSE, - 0); + // Create a process handle that the renderer process can give to the GPU + // process to give it access to its handles. + DuplicateHandle(base::GetCurrentProcessHandle(), + filter_->peer_handle(), + gpu_process_for_browser, + &renderer_process_for_gpu, + PROCESS_DUP_HANDLE, + FALSE, + 0); #else - renderer_process_for_gpu = filter_->peer_handle(); + renderer_process_for_gpu = filter_->peer_handle(); #endif + } else { + renderer_process_for_gpu = 0; + } DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); IPC::Message* reply = new GpuMsg_GpuChannelEstablished( |