Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(151)

Unified Diff: content/plugin/plugin_channel.cc

Issue 6992006: Terminate plugin processes on a delayed task to allow the plugins to shutdown gracefully, i.e. NP... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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
@@ -85,9 +95,17 @@
return channel_->Send(message);
}
jam 2011/05/24 20:46:13 nit: extra line
ananta 2011/05/24 20:56:26 Done.
+
private:
void OnFilterAdded(IPC::Channel* channel) { channel_ = channel; }
+ virtual void OnChannelError() {
+ // Ensure that we don't wait indefinitely for the plugin to shutdown.
jam 2011/05/24 20:46:13 nit: can you please add just one extra line to say
ananta 2011/05/24 20:56:26 Done.
+ 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)
« content/browser/plugin_process_host.cc ('K') | « content/browser/plugin_process_host.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698