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

Unified Diff: content/browser/child_process_launcher.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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/child_process_launcher.cc
===================================================================
--- content/browser/child_process_launcher.cc (revision 86295)
+++ content/browser/child_process_launcher.cc (working copy)
@@ -105,6 +105,7 @@
#endif
CommandLine* cmd_line) {
scoped_ptr<CommandLine> cmd_line_deleter(cmd_line);
+ process_type_ = cmd_line->GetSwitchValueASCII(switches::kProcessType);
base::ProcessHandle handle = base::kNullProcessHandle;
#if defined(OS_WIN)
handle = sandbox::StartProcessWithAccess(cmd_line, exposed_dir);
@@ -210,16 +211,30 @@
if (!process_.handle())
return;
+ const int kPluginProcessTerminateTimeoutMs = 2000;
+
// On Posix, EnsureProcessTerminated can lead to 2 seconds of sleep! So
// don't this on the UI/IO threads.
- BrowserThread::PostTask(
- BrowserThread::PROCESS_LAUNCHER, FROM_HERE,
- NewRunnableFunction(
- &ChildProcessLauncher::Context::TerminateInternal,
-#if defined(OS_LINUX)
- zygote_,
-#endif
- process_.handle()));
+ // Allow plugins to shutdown gracefully before terminating the process.
+ if (process_type_ == switches::kPluginProcess) {
jam 2011/05/23 22:32:59 ChildProcessLauncher is the base class that's used
+ BrowserThread::PostDelayedTask(
+ BrowserThread::PROCESS_LAUNCHER, FROM_HERE,
+ NewRunnableFunction(
+ &ChildProcessLauncher::Context::TerminateInternal,
+ #if defined(OS_LINUX)
+ zygote_,
+ #endif
+ process_.handle()), kPluginProcessTerminateTimeoutMs);
+ } else {
+ BrowserThread::PostTask(
+ BrowserThread::PROCESS_LAUNCHER, FROM_HERE,
+ NewRunnableFunction(
+ &ChildProcessLauncher::Context::TerminateInternal,
+ #if defined(OS_LINUX)
+ zygote_,
+ #endif
+ process_.handle()));
+ }
process_.set_handle(base::kNullProcessHandle);
}
@@ -257,6 +272,7 @@
BrowserThread::ID client_thread_id_;
base::Process process_;
bool starting_;
+ std::string process_type_;
#if defined(OS_LINUX)
bool zygote_;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698