summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-14 13:03:01 +0000
committerjochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-14 13:03:01 +0000
commit33d63100ca00694d04f09aa76ee8629e0e56f2af (patch)
treeba4886bc196b60fd9d026f2bdf34724910697dea
parent0bb1bd2fb9fc99f33f5602a42e5b4070fb4864f1 (diff)
downloadchromium_src-33d63100ca00694d04f09aa76ee8629e0e56f2af.zip
chromium_src-33d63100ca00694d04f09aa76ee8629e0e56f2af.tar.gz
chromium_src-33d63100ca00694d04f09aa76ee8629e0e56f2af.tar.bz2
Add a callback to GpuDataManagerObserver for when a GPU host crashes.
If this happens during layout tests, we'll just return incorrect pixel results. With this new callback, we can instead correctly report a crash BUG=111316 R=piman@chromium.org TEST=WebKit (content shell) Mac bot has less image failures (but lots more crashes) Review URL: https://codereview.chromium.org/12823003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@188048 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--content/browser/gpu/gpu_data_manager_impl.cc13
-rw-r--r--content/browser/gpu/gpu_data_manager_impl.h3
-rw-r--r--content/browser/gpu/gpu_process_host.cc2
-rw-r--r--content/public/browser/gpu_data_manager_observer.h4
-rw-r--r--content/shell/webkit_test_controller.cc10
-rw-r--r--content/shell/webkit_test_controller.h7
6 files changed, 38 insertions, 1 deletions
diff --git a/content/browser/gpu/gpu_data_manager_impl.cc b/content/browser/gpu/gpu_data_manager_impl.cc
index 5c31e37..51d3f3b 100644
--- a/content/browser/gpu/gpu_data_manager_impl.cc
+++ b/content/browser/gpu/gpu_data_manager_impl.cc
@@ -512,6 +512,19 @@ void GpuDataManagerImpl::AddLogMessage(
log_messages_.Append(dict);
}
+void GpuDataManagerImpl::ProcessCrashed(base::TerminationStatus exit_code) {
+ if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) {
+ BrowserThread::PostTask(BrowserThread::UI,
+ FROM_HERE,
+ base::Bind(&GpuDataManagerImpl::ProcessCrashed,
+ base::Unretained(this),
+ exit_code));
+ return;
+ }
+ observer_list_->Notify(&GpuDataManagerObserver::OnGpuProcessCrashed,
+ exit_code);
+}
+
base::ListValue* GpuDataManagerImpl::GetLogMessages() const {
base::ListValue* value;
{
diff --git a/content/browser/gpu/gpu_data_manager_impl.h b/content/browser/gpu/gpu_data_manager_impl.h
index 9de762f..9d2835e 100644
--- a/content/browser/gpu/gpu_data_manager_impl.h
+++ b/content/browser/gpu/gpu_data_manager_impl.h
@@ -15,6 +15,7 @@
#include "base/memory/ref_counted.h"
#include "base/memory/singleton.h"
#include "base/observer_list_threadsafe.h"
+#include "base/process_util.h"
#include "base/synchronization/lock.h"
#include "base/time.h"
#include "base/values.h"
@@ -117,6 +118,8 @@ class CONTENT_EXPORT GpuDataManagerImpl
const std::string& header,
const std::string& message);
+ void ProcessCrashed(base::TerminationStatus exit_code);
+
// Returns a new copy of the ListValue. Caller is responsible to release
// the returned value.
base::ListValue* GetLogMessages() const;
diff --git a/content/browser/gpu/gpu_process_host.cc b/content/browser/gpu/gpu_process_host.cc
index 28e008e..98e8351 100644
--- a/content/browser/gpu/gpu_process_host.cc
+++ b/content/browser/gpu/gpu_process_host.cc
@@ -962,6 +962,8 @@ void GpuProcessHost::OnProcessLaunched() {
void GpuProcessHost::OnProcessCrashed(int exit_code) {
SendOutstandingReplies();
+ GpuDataManagerImpl::GetInstance()->ProcessCrashed(
+ process_->GetTerminationStatus(NULL));
}
bool GpuProcessHost::software_rendering() {
diff --git a/content/public/browser/gpu_data_manager_observer.h b/content/public/browser/gpu_data_manager_observer.h
index 1db650b..4ed348e 100644
--- a/content/public/browser/gpu_data_manager_observer.h
+++ b/content/public/browser/gpu_data_manager_observer.h
@@ -5,6 +5,7 @@
#ifndef CONTENT_PUBLIC_BROWSER_GPU_DATA_MANAGER_OBSERVER_H_
#define CONTENT_PUBLIC_BROWSER_GPU_DATA_MANAGER_OBSERVER_H_
+#include "base/process_util.h"
#include "content/common/content_export.h"
#include "content/public/common/gpu_memory_stats.h"
#include "content/public/common/three_d_api_types.h"
@@ -31,6 +32,9 @@ class GpuDataManagerObserver {
int render_view_id,
ThreeDAPIType requester) {}
+ // Called for any observer when the GPU process crashed.
+ virtual void OnGpuProcessCrashed(base::TerminationStatus exit_code) {}
+
protected:
virtual ~GpuDataManagerObserver() {}
};
diff --git a/content/shell/webkit_test_controller.cc b/content/shell/webkit_test_controller.cc
index e29d407..99f0a80 100644
--- a/content/shell/webkit_test_controller.cc
+++ b/content/shell/webkit_test_controller.cc
@@ -13,6 +13,7 @@
#include "base/string_number_conversions.h"
#include "base/stringprintf.h"
#include "content/public/browser/devtools_manager.h"
+#include "content/public/browser/gpu_data_manager.h"
#include "content/public/browser/navigation_controller.h"
#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/notification_service.h"
@@ -177,6 +178,7 @@ WebKitTestController::WebKitTestController()
registrar_.Add(this,
NOTIFICATION_RENDERER_PROCESS_CREATED,
NotificationService::AllSources());
+ GpuDataManager::GetInstance()->AddObserver(this);
ResetAfterLayoutTest();
}
@@ -184,6 +186,7 @@ WebKitTestController::~WebKitTestController() {
DCHECK(CalledOnValidThread());
CHECK(instance_ == this);
CHECK(!is_running_test_);
+ GpuDataManager::GetInstance()->RemoveObserver(this);
DiscardMainWindow();
instance_ = NULL;
}
@@ -393,6 +396,13 @@ void WebKitTestController::Observe(int type,
}
}
+void WebKitTestController::OnGpuProcessCrashed(
+ base::TerminationStatus exit_code) {
+ DCHECK(CalledOnValidThread());
+ printer_->AddErrorMessage("#CRASHED - gpu");
+ DiscardMainWindow();
+}
+
void WebKitTestController::TimeoutHandler() {
DCHECK(CalledOnValidThread());
printer_->AddErrorMessage(
diff --git a/content/shell/webkit_test_controller.h b/content/shell/webkit_test_controller.h
index 60838f8..bf18e3b 100644
--- a/content/shell/webkit_test_controller.h
+++ b/content/shell/webkit_test_controller.h
@@ -12,6 +12,7 @@
#include "base/files/file_path.h"
#include "base/synchronization/lock.h"
#include "base/threading/non_thread_safe.h"
+#include "content/public/browser/gpu_data_manager_observer.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
#include "content/public/browser/render_view_host_observer.h"
@@ -73,7 +74,8 @@ class WebKitTestResultPrinter {
class WebKitTestController : public base::NonThreadSafe,
public WebContentsObserver,
- public NotificationObserver {
+ public NotificationObserver,
+ public GpuDataManagerObserver {
public:
static WebKitTestController* Get();
@@ -114,6 +116,9 @@ class WebKitTestController : public base::NonThreadSafe,
const NotificationSource& source,
const NotificationDetails& details) OVERRIDE;
+ // GpuDataManagerObserver implementation.
+ virtual void OnGpuProcessCrashed(base::TerminationStatus exit_code) OVERRIDE;
+
private:
static WebKitTestController* instance_;