diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-10 05:43:52 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-10 05:43:52 +0000 |
commit | a9804182695a04d5239f54d10c2a563881ff0bf5 (patch) | |
tree | 63746331e8fce04f644f254a99eef3e8d83c0ae0 /content/renderer/renderer_main.cc | |
parent | ea0f42ab4e263a723bb4cb03ef2f682d4158b9ea (diff) | |
download | chromium_src-a9804182695a04d5239f54d10c2a563881ff0bf5.zip chromium_src-a9804182695a04d5239f54d10c2a563881ff0bf5.tar.gz chromium_src-a9804182695a04d5239f54d10c2a563881ff0bf5.tar.bz2 |
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
Diffstat (limited to 'content/renderer/renderer_main.cc')
-rw-r--r-- | content/renderer/renderer_main.cc | 35 |
1 files changed, 33 insertions, 2 deletions
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. |