summaryrefslogtreecommitdiffstats
path: root/content/browser/child_process_launcher.cc
diff options
context:
space:
mode:
authorananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-25 02:12:45 +0000
committerananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-25 02:12:45 +0000
commit358cb8e568f9ba89283fb0ed71b4a51947d1307f (patch)
treead8ee1c535a300062623a30d18159289034435cf /content/browser/child_process_launcher.cc
parent8bda37982625717b2b194d61f527ffbbd9cd4ba0 (diff)
downloadchromium_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/browser/child_process_launcher.cc')
-rw-r--r--content/browser/child_process_launcher.cc20
1 files changed, 19 insertions, 1 deletions
diff --git a/content/browser/child_process_launcher.cc b/content/browser/child_process_launcher.cc
index 785d8a1..5d3888e 100644
--- a/content/browser/child_process_launcher.cc
+++ b/content/browser/child_process_launcher.cc
@@ -44,7 +44,8 @@ class ChildProcessLauncher::Context
Context()
: client_(NULL),
client_thread_id_(BrowserThread::UI),
- starting_(true)
+ starting_(true),
+ terminate_child_on_shutdown_(true)
#if defined(OS_LINUX)
, zygote_(false)
#endif
@@ -87,6 +88,10 @@ class ChildProcessLauncher::Context
client_ = NULL;
}
+ void set_terminate_child_on_shutdown(bool terminate_on_shutdown) {
+ terminate_child_on_shutdown_ = terminate_on_shutdown;
+ }
+
private:
friend class base::RefCountedThreadSafe<ChildProcessLauncher::Context>;
friend class ChildProcessLauncher;
@@ -210,6 +215,9 @@ class ChildProcessLauncher::Context
if (!process_.handle())
return;
+ if (!terminate_child_on_shutdown_)
+ return;
+
// On Posix, EnsureProcessTerminated can lead to 2 seconds of sleep! So
// don't this on the UI/IO threads.
BrowserThread::PostTask(
@@ -257,6 +265,9 @@ class ChildProcessLauncher::Context
BrowserThread::ID client_thread_id_;
base::Process process_;
bool starting_;
+ // Controls whether the child process should be terminated on browser
+ // shutdown. Default behavior is to terminate the child.
+ bool terminate_child_on_shutdown_;
#if defined(OS_LINUX)
bool zygote_;
@@ -333,3 +344,10 @@ void ChildProcessLauncher::SetProcessBackgrounded(bool background) {
&ChildProcessLauncher::Context::SetProcessBackgrounded,
background));
}
+
+void ChildProcessLauncher::SetTerminateChildOnShutdown(
+ bool terminate_on_shutdown) {
+ if (context_)
+ context_->set_terminate_child_on_shutdown(terminate_on_shutdown);
+}
+