From a9804182695a04d5239f54d10c2a563881ff0bf5 Mon Sep 17 00:00:00 2001 From: "jam@chromium.org" Date: Tue, 10 Apr 2012 05:43:52 +0000 Subject: Reland r131429 (Moved SuicideOnChannelErrorFilter to content.). Install it in renderer_main.cc so that it's not used in tests. Review URL: https://chromiumcodereview.appspot.com/10032023 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@131537 0039d316-1c4b-4281-b951-d872f2087c98 --- content/renderer/renderer_main.cc | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) (limited to 'content/renderer/renderer_main.cc') diff --git a/content/renderer/renderer_main.cc b/content/renderer/renderer_main.cc index 306dee9a..80ec45d 100644 --- a/content/renderer/renderer_main.cc +++ b/content/renderer/renderer_main.cc @@ -41,9 +41,10 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" #endif // OS_MACOSX -#if defined(OS_MACOSX) namespace { +#if defined(OS_MACOSX) + CFArrayRef ChromeTISCreateInputSourceList( CFDictionaryRef properties, Boolean includeAllInstalled) { @@ -68,9 +69,35 @@ void InstallFrameworkHacks() { } } -} // namespace #endif // OS_MACOSX +#if defined(OS_POSIX) + +class SuicideOnChannelErrorFilter : public IPC::ChannelProxy::MessageFilter { + void OnChannelError() { + // On POSIX, at least, one can install an unload handler which loops + // forever and leave behind a renderer process which eats 100% CPU forever. + // + // This is because the terminate signals (ViewMsg_ShouldClose and the error + // from the IPC channel) are routed to the main message loop but never + // processed (because that message loop is stuck in V8). + // + // One could make the browser SIGKILL the renderers, but that leaves open a + // large window where a browser failure (or a user, manually terminating + // the browser because "it's stuck") will leave behind a process eating all + // the CPU. + // + // So, we install a filter on the channel so that we can process this event + // here and kill the process. + + _exit(0); + } +}; + +#endif // OS(POSIX) + +} // namespace + // This function provides some ways to test crash and assertion handling // behavior of the renderer. static void HandleRendererErrorTestParameters(const CommandLine& command_line) { @@ -228,6 +255,10 @@ int RendererMain(const content::MainFunctionParams& parameters) { new RenderThreadImpl(); #endif +#if defined(OS_POSIX) + RenderThreadImpl::current()->AddFilter(new SuicideOnChannelErrorFilter()); +#endif + platform.RunSandboxTests(); startup_timer.Stop(); // End of Startup Time Measurement. -- cgit v1.1