Index: content/plugin/plugin_channel.cc |
=================================================================== |
--- content/plugin/plugin_channel.cc (revision 86295) |
+++ content/plugin/plugin_channel.cc (working copy) |
@@ -32,9 +32,19 @@ |
} |
}; |
+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 @@ |
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) |