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

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
Index: content/browser/child_process_launcher.cc
===================================================================
--- content/browser/child_process_launcher.cc (revision 86295)
+++ content/browser/child_process_launcher.cc (working copy)
@@ -44,7 +44,8 @@
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,12 @@
client_ = NULL;
}
+ // Controls whether the child process should be terminated on browser
+ // shutdown. Default behavior is to terminate the child..
jam 2011/05/24 20:46:13 nit: one period at end. also, comments usually go
ananta 2011/05/24 20:56:26 Done.
+ 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 +217,10 @@
if (!process_.handle())
return;
+ if (!terminate_child_on_shutdown_) {
jam 2011/05/24 20:46:13 nit: this file doesn't use brace brackets for one
ananta 2011/05/24 20:56:26 Done.
ananta 2011/05/24 20:56:26 Done.
+ return;
+ }
+
// On Posix, EnsureProcessTerminated can lead to 2 seconds of sleep! So
// don't this on the UI/IO threads.
BrowserThread::PostTask(
@@ -257,6 +268,7 @@
BrowserThread::ID client_thread_id_;
base::Process process_;
bool starting_;
+ bool terminate_child_on_shutdown_;
#if defined(OS_LINUX)
bool zygote_;
@@ -333,3 +345,11 @@
&ChildProcessLauncher::Context::SetProcessBackgrounded,
background));
}
+
+void ChildProcessLauncher::SetTerminateChildOnShutdown(
+ bool terminate_on_shutdown) {
+ if (context_) {
jam 2011/05/24 20:46:13 ditto
ananta 2011/05/24 20:56:26 Done.
+ context_->set_terminate_child_on_shutdown(terminate_on_shutdown);
+ }
+}
+

Powered by Google App Engine
This is Rietveld 408576698