summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/browser_about_handler.cc8
-rw-r--r--chrome/browser/gpu_process_host.cc5
-rw-r--r--chrome/browser/gpu_process_host.h3
-rw-r--r--chrome/common/gpu_messages_internal.h3
-rw-r--r--chrome/common/url_constants.cc1
-rw-r--r--chrome/common/url_constants.h1
-rw-r--r--chrome/gpu/gpu_thread.cc8
-rw-r--r--chrome/gpu/gpu_thread.h1
8 files changed, 29 insertions, 1 deletions
diff --git a/chrome/browser/browser_about_handler.cc b/chrome/browser/browser_about_handler.cc
index 4c1b016..3f9abc2 100644
--- a/chrome/browser/browser_about_handler.cc
+++ b/chrome/browser/browser_about_handler.cc
@@ -273,7 +273,7 @@ std::string AboutAbout() {
html.append(kAllAboutPaths[i]);
html.append("</a>\n");
}
- const char *debug[] = { "crash", "hang", "shorthang" };
+ const char *debug[] = { "crash", "hang", "shorthang", "gpucrash" };
html.append("</ul><h2>For Debug</h2>");
html.append("</ul><p>The following pages are for debugging purposes only. "
"Because they crash or hang the renderer, they're not linked "
@@ -1209,6 +1209,12 @@ bool WillHandleBrowserAboutURL(GURL* url, Profile* profile) {
return true;
}
+ // Handle URL to crash the gpu process.
+ if (LowerCaseEqualsASCII(url->spec(), chrome::kAboutGpuCrashURL)) {
+ GpuProcessHost::SendAboutGpuCrash();
+ return true;
+ }
+
// There are a few about: URLs that we hand over to the renderer. If the
// renderer wants them, don't do any rewriting.
if (chrome_about_handler::WillHandle(*url))
diff --git a/chrome/browser/gpu_process_host.cc b/chrome/browser/gpu_process_host.cc
index be60c19..f2bba1f 100644
--- a/chrome/browser/gpu_process_host.cc
+++ b/chrome/browser/gpu_process_host.cc
@@ -122,6 +122,11 @@ GpuProcessHost* GpuProcessHost::Get() {
return sole_instance_;
}
+// static
+void GpuProcessHost::SendAboutGpuCrash() {
+ Get()->Send(new GpuMsg_Crash());
+}
+
bool GpuProcessHost::Send(IPC::Message* msg) {
if (!EnsureInitialized())
return false;
diff --git a/chrome/browser/gpu_process_host.h b/chrome/browser/gpu_process_host.h
index 77e825b..d885408 100644
--- a/chrome/browser/gpu_process_host.h
+++ b/chrome/browser/gpu_process_host.h
@@ -28,6 +28,9 @@ class GpuProcessHost : public BrowserChildProcessHost {
// Getter for the singleton. This will return NULL on failure.
static GpuProcessHost* Get();
+ // Tells the GPU process to crash. Useful for testing.
+ static void SendAboutGpuCrash();
+
// Shutdown routine, which should only be called upon process
// termination.
static void Shutdown();
diff --git a/chrome/common/gpu_messages_internal.h b/chrome/common/gpu_messages_internal.h
index c1a02be..e281f371 100644
--- a/chrome/common/gpu_messages_internal.h
+++ b/chrome/common/gpu_messages_internal.h
@@ -50,6 +50,9 @@ IPC_BEGIN_MESSAGES(Gpu)
// information.
IPC_MESSAGE_CONTROL0(GpuMsg_CollectGraphicsInfo)
+ // Tells the GPU process to crash.
+ IPC_MESSAGE_CONTROL0(GpuMsg_Crash)
+
// Creates a new backing store.
IPC_MESSAGE_ROUTED2(GpuMsg_NewBackingStore,
int32, /* backing_store_routing_id */
diff --git a/chrome/common/url_constants.cc b/chrome/common/url_constants.cc
index f75a530..8157bce 100644
--- a/chrome/common/url_constants.cc
+++ b/chrome/common/url_constants.cc
@@ -49,6 +49,7 @@ const char kAboutCacheURL[] = "about:cache";
const char kAboutCrashURL[] = "about:crash";
const char kAboutCreditsURL[] = "about:credits";
const char kAboutDNSURL[] = "about:dns";
+const char kAboutGpuCrashURL[] = "about:gpucrash";
const char kAboutHangURL[] = "about:hang";
const char kAboutHistogramsURL[] = "about:histograms";
const char kAboutLabsURL[] = "about:labs";
diff --git a/chrome/common/url_constants.h b/chrome/common/url_constants.h
index 80728fa..eb9f7b7 100644
--- a/chrome/common/url_constants.h
+++ b/chrome/common/url_constants.h
@@ -44,6 +44,7 @@ extern const char kAboutCacheURL[];
extern const char kAboutCrashURL[];
extern const char kAboutCreditsURL[];
extern const char kAboutDNSURL[];
+extern const char kAboutGpuCrashURL[];
extern const char kAboutHangURL[];
extern const char kAboutHistogramsURL[];
extern const char kAboutLabsURL[];
diff --git a/chrome/gpu/gpu_thread.cc b/chrome/gpu/gpu_thread.cc
index f1e5148..97cb5d1 100644
--- a/chrome/gpu/gpu_thread.cc
+++ b/chrome/gpu/gpu_thread.cc
@@ -89,6 +89,8 @@ void GpuThread::OnControlMessageReceived(const IPC::Message& msg) {
OnNewRenderWidgetHostView)
IPC_MESSAGE_HANDLER(GpuMsg_CollectGraphicsInfo,
OnCollectGraphicsInfo)
+ IPC_MESSAGE_HANDLER(GpuMsg_Crash,
+ OnCrash)
IPC_END_MESSAGE_MAP_EX()
}
@@ -160,3 +162,9 @@ void GpuThread::OnCollectGraphicsInfo() {
Send(new GpuHostMsg_GraphicsInfoCollected(gpu_info));
}
+
+void GpuThread::OnCrash() {
+ // Good bye, cruel world.
+ volatile int* it_s_the_end_of_the_world_as_we_know_it = NULL;
+ *it_s_the_end_of_the_world_as_we_know_it = 0xdead;
+}
diff --git a/chrome/gpu/gpu_thread.h b/chrome/gpu/gpu_thread.h
index fb23d7f..519b092 100644
--- a/chrome/gpu/gpu_thread.h
+++ b/chrome/gpu/gpu_thread.h
@@ -42,6 +42,7 @@ class GpuThread : public ChildThread {
void OnEstablishChannel(int renderer_id);
void OnSynchronize();
void OnCollectGraphicsInfo();
+ void OnCrash();
void OnNewRenderWidgetHostView(GpuNativeWindowHandle parent_window,
int32 routing_id);