diff options
-rw-r--r-- | chrome/browser/browser_about_handler.cc | 8 | ||||
-rw-r--r-- | chrome/browser/gpu_process_host.cc | 5 | ||||
-rw-r--r-- | chrome/browser/gpu_process_host.h | 4 | ||||
-rw-r--r-- | chrome/common/gpu_messages_internal.h | 3 | ||||
-rw-r--r-- | chrome/common/url_constants.cc | 1 | ||||
-rw-r--r-- | chrome/common/url_constants.h | 1 | ||||
-rw-r--r-- | chrome/gpu/gpu_thread.cc | 7 | ||||
-rw-r--r-- | chrome/gpu/gpu_thread.h | 1 |
8 files changed, 28 insertions, 2 deletions
diff --git a/chrome/browser/browser_about_handler.cc b/chrome/browser/browser_about_handler.cc index 4406a31..69ad244 100644 --- a/chrome/browser/browser_about_handler.cc +++ b/chrome/browser/browser_about_handler.cc @@ -271,7 +271,7 @@ std::string AboutAbout() { html.append(kAllAboutPaths[i]); html.append("</a>\n"); } - const char *debug[] = { "crash", "hang", "shorthang", "gpucrash" }; + const char *debug[] = { "crash", "hang", "shorthang", "gpucrash", "gpuhang" }; 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 " @@ -1160,11 +1160,15 @@ bool WillHandleBrowserAboutURL(GURL* url, Profile* profile) { return true; } - // Handle URL to crash the gpu process. + // Handle URLs to wreck the gpu process. if (LowerCaseEqualsASCII(url->spec(), chrome::kAboutGpuCrashURL)) { GpuProcessHost::SendAboutGpuCrash(); return true; } + if (LowerCaseEqualsASCII(url->spec(), chrome::kAboutGpuHangURL)) { + GpuProcessHost::SendAboutGpuHang(); + 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. diff --git a/chrome/browser/gpu_process_host.cc b/chrome/browser/gpu_process_host.cc index f2bba1f..f4c6164 100644 --- a/chrome/browser/gpu_process_host.cc +++ b/chrome/browser/gpu_process_host.cc @@ -127,6 +127,11 @@ void GpuProcessHost::SendAboutGpuCrash() { Get()->Send(new GpuMsg_Crash()); } +// static +void GpuProcessHost::SendAboutGpuHang() { + Get()->Send(new GpuMsg_Hang()); +} + 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 d885408..e4d4559 100644 --- a/chrome/browser/gpu_process_host.h +++ b/chrome/browser/gpu_process_host.h @@ -31,6 +31,10 @@ class GpuProcessHost : public BrowserChildProcessHost { // Tells the GPU process to crash. Useful for testing. static void SendAboutGpuCrash(); + // Tells the GPU process to let its main thread enter an infinite loop. + // Useful for testing. + static void SendAboutGpuHang(); + // 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 229e3db..0121e16 100644 --- a/chrome/common/gpu_messages_internal.h +++ b/chrome/common/gpu_messages_internal.h @@ -53,6 +53,9 @@ IPC_BEGIN_MESSAGES(Gpu) // Tells the GPU process to crash. IPC_MESSAGE_CONTROL0(GpuMsg_Crash) + // Tells the GPU process to hang. + IPC_MESSAGE_CONTROL0(GpuMsg_Hang) + // 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 5ae5181..8a119f9 100644 --- a/chrome/common/url_constants.cc +++ b/chrome/common/url_constants.cc @@ -50,6 +50,7 @@ const char kAboutCrashURL[] = "about:crash"; const char kAboutCreditsURL[] = "about:credits"; const char kAboutDNSURL[] = "about:dns"; const char kAboutGpuCrashURL[] = "about:gpucrash"; +const char kAboutGpuHangURL[] = "about:gpuhang"; 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 cd2f889..b665550 100644 --- a/chrome/common/url_constants.h +++ b/chrome/common/url_constants.h @@ -45,6 +45,7 @@ extern const char kAboutCrashURL[]; extern const char kAboutCreditsURL[]; extern const char kAboutDNSURL[]; extern const char kAboutGpuCrashURL[]; +extern const char kAboutGpuHangURL[]; 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 97cb5d1..cb2a89b 100644 --- a/chrome/gpu/gpu_thread.cc +++ b/chrome/gpu/gpu_thread.cc @@ -91,6 +91,8 @@ void GpuThread::OnControlMessageReceived(const IPC::Message& msg) { OnCollectGraphicsInfo) IPC_MESSAGE_HANDLER(GpuMsg_Crash, OnCrash) + IPC_MESSAGE_HANDLER(GpuMsg_Hang, + OnHang) IPC_END_MESSAGE_MAP_EX() } @@ -168,3 +170,8 @@ void GpuThread::OnCrash() { 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; } + +void GpuThread::OnHang() { + for (;;) + PlatformThread::Sleep(1000); +} diff --git a/chrome/gpu/gpu_thread.h b/chrome/gpu/gpu_thread.h index 519b092..b896360 100644 --- a/chrome/gpu/gpu_thread.h +++ b/chrome/gpu/gpu_thread.h @@ -43,6 +43,7 @@ class GpuThread : public ChildThread { void OnSynchronize(); void OnCollectGraphicsInfo(); void OnCrash(); + void OnHang(); void OnNewRenderWidgetHostView(GpuNativeWindowHandle parent_window, int32 routing_id); |