diff options
author | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-25 02:12:45 +0000 |
---|---|---|
committer | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-25 02:12:45 +0000 |
commit | 358cb8e568f9ba89283fb0ed71b4a51947d1307f (patch) | |
tree | ad8ee1c535a300062623a30d18159289034435cf /content/plugin | |
parent | 8bda37982625717b2b194d61f527ffbbd9cd4ba0 (diff) | |
download | chromium_src-358cb8e568f9ba89283fb0ed71b4a51947d1307f.zip chromium_src-358cb8e568f9ba89283fb0ed71b4a51947d1307f.tar.gz chromium_src-358cb8e568f9ba89283fb0ed71b4a51947d1307f.tar.bz2 |
Revert 86532 - Revert 86517 - Don't terminate plugin processes from the browser during browser shutdown. This is to allow the plugins to
shutdown gracefully, i.e. NP_Shutdown gets called. To ensure that we handle the case of a hung plugin, we handle
the OnChannelError notification in the IPC message filter implementation in the plugin process and post a delayed
task to kill the process.
Fixes bug http://code.google.com/p/chromium/issues/detail?id=48178
BUG=48178
Review URL: http://codereview.chromium.org/6992006
TBR=ananta@chromium.org
Review URL: http://codereview.chromium.org/7065048
TBR=nsylvain@chromium.org
Review URL: http://codereview.chromium.org/7053008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@86554 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/plugin')
-rw-r--r-- | content/plugin/plugin_channel.cc | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/content/plugin/plugin_channel.cc b/content/plugin/plugin_channel.cc index cd2e99f..dd00a75 100644 --- a/content/plugin/plugin_channel.cc +++ b/content/plugin/plugin_channel.cc @@ -32,9 +32,19 @@ class PluginReleaseTask : public Task { } }; +class PluginProcessExitTask : public Task { + public: + void Run() { + base::KillProcess(base::GetCurrentProcessHandle(), 0, false); + } +}; + // How long we wait before releasing the plugin process. const int kPluginReleaseTimeMs = 5 * 60 * 1000; // 5 minutes +// How long we wait before forcibly shutting down the process. +const int kPluginProcessTerminateTimeoutMs = 3000; + } // namespace // If a sync call to the renderer results in a modal dialog, we need to have a @@ -88,6 +98,15 @@ class PluginChannel::MessageFilter : public IPC::ChannelProxy::MessageFilter { private: void OnFilterAdded(IPC::Channel* channel) { channel_ = channel; } + virtual void OnChannelError() { + // 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, + new PluginProcessExitTask(), + kPluginProcessTerminateTimeoutMs); + } + bool OnMessageReceived(const IPC::Message& message) { IPC_BEGIN_MESSAGE_MAP(PluginChannel::MessageFilter, message) IPC_MESSAGE_HANDLER_DELAY_REPLY(PluginMsg_Init, OnInit) |