summaryrefslogtreecommitdiffstats
path: root/content/plugin/plugin_thread.cc
diff options
context:
space:
mode:
authorananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-31 22:39:18 +0000
committerananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-31 22:39:18 +0000
commitd870dcb0264d9b58ccf2c49d7ee1a2c5b8309ae1 (patch)
tree6353f052618fb0b506fa9e07d39f909736dbb703 /content/plugin/plugin_thread.cc
parentdad3f5a65d67f60c9909ff3ea63e04d57aec2dfd (diff)
downloadchromium_src-d870dcb0264d9b58ccf2c49d7ee1a2c5b8309ae1.zip
chromium_src-d870dcb0264d9b58ccf2c49d7ee1a2c5b8309ae1.tar.gz
chromium_src-d870dcb0264d9b58ccf2c49d7ee1a2c5b8309ae1.tar.bz2
Fix a regression caused by the fix to ensure that NP_Shutdown is called for plugins when the browser
process shuts down. The regression basically caused the plugin process to terminate when a renderer process died, thus leaving other renderers using the plugin process in flux. Fix is to move the OnChannelError processing from the PluginChannel message filter implementation which handles a renderer plugin channel to a new message filter instance created in conjunction with the Pluginthread class. This message filter instance handles the browser plugin channel. Fixes bug http://code.google.com/p/chromium/issues/detail?id=84156 BUG=84156 Review URL: http://codereview.chromium.org/7006009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@87384 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/plugin/plugin_thread.cc')
-rw-r--r--content/plugin/plugin_thread.cc28
1 files changed, 28 insertions, 0 deletions
diff --git a/content/plugin/plugin_thread.cc b/content/plugin/plugin_thread.cc
index 18455d2..c5d2953 100644
--- a/content/plugin/plugin_thread.cc
+++ b/content/plugin/plugin_thread.cc
@@ -39,6 +39,33 @@
#include "ui/base/x/x11_util.h"
#endif
+namespace {
+
+class EnsureTerminateMessageFilter : public IPC::ChannelProxy::MessageFilter {
+ public:
+ EnsureTerminateMessageFilter() {}
+ ~EnsureTerminateMessageFilter() {}
+
+ private:
+ virtual void OnChannelError() {
+ // How long we wait before forcibly shutting down the process.
+ const int kPluginProcessTerminateTimeoutMs = 3000;
+ // Ensure that we don't wait indefinitely for the plugin to shutdown.
+ // as the browser does not terminate plugin processes on shutdown.
+ // We achieve this by posting an exit process task on the IO thread.
+ MessageLoop::current()->PostDelayedTask(
+ FROM_HERE,
+ NewRunnableMethod(this, &EnsureTerminateMessageFilter::Terminate),
+ kPluginProcessTerminateTimeoutMs);
+ }
+
+ void Terminate() {
+ base::KillProcess(base::GetCurrentProcessHandle(), 0, false);
+ }
+};
+
+} // namespace
+
static base::LazyInstance<base::ThreadLocalPointer<PluginThread> > lazy_tls(
base::LINKER_INITIALIZED);
@@ -91,6 +118,7 @@ PluginThread::PluginThread()
// Certain plugins, such as flash, steal the unhandled exception filter
// thus we never get crash reports when they fault. This call fixes it.
message_loop()->set_exception_restoration(true);
+ channel()->AddFilter(new EnsureTerminateMessageFilter());
}
PluginThread::~PluginThread() {