summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authorasharif@chromium.org <asharif@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-09 20:54:15 +0000
committerasharif@chromium.org <asharif@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-09 20:54:15 +0000
commite07111ca714ec78910bb18136c5b1f2900160007 (patch)
tree3cfee99a50c4bbf1509b0d5c04fa89ffd099df3e /content
parent68e9974729ea59b64d47ea9a4de2d5b096f30e07 (diff)
downloadchromium_src-e07111ca714ec78910bb18136c5b1f2900160007.zip
chromium_src-e07111ca714ec78910bb18136c5b1f2900160007.tar.gz
chromium_src-e07111ca714ec78910bb18136c5b1f2900160007.tar.bz2
Moved SuicideOnChannelErrorFilter to content.
BUG=none TEST=trybots Review URL: http://codereview.chromium.org/10027027 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@131429 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r--content/renderer/render_thread_impl.cc28
1 files changed, 28 insertions, 0 deletions
diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc
index 320c820..9acb852 100644
--- a/content/renderer/render_thread_impl.cc
+++ b/content/renderer/render_thread_impl.cc
@@ -179,6 +179,30 @@ RenderThreadImpl::RenderThreadImpl(const std::string& channel_name)
Init();
}
+#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
+
+
void RenderThreadImpl::Init() {
TRACE_EVENT_BEGIN_ETW("RenderThreadImpl::Init", 0, "");
@@ -232,6 +256,10 @@ void RenderThreadImpl::Init() {
AddFilter(new IndexedDBMessageFilter);
+#if defined(OS_POSIX)
+ AddFilter(new SuicideOnChannelErrorFilter());
+#endif
+
content::GetContentClient()->renderer()->RenderThreadStarted();
// Note that under Linux, the media library will normally already have