Windows: Force child processes to exit on main process termination (issue #1011).

git-svn-id: https://chromiumembedded.googlecode.com/svn/branches/1547@1350 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt
2013-07-29 17:39:01 +00:00
parent a40573d302
commit c69f78fef2
2 changed files with 29 additions and 0 deletions

View File

@ -0,0 +1,23 @@
Index: sandbox_win.cc
===================================================================
--- sandbox_win.cc (revision 211613)
+++ sandbox_win.cc (working copy)
@@ -586,8 +586,17 @@
cmd_line->AppendArg(base::StringPrintf("/prefetch:%d", base::Hash(type_str)));
if (!in_sandbox) {
+ base::LaunchOptions options = base::LaunchOptions();
base::ProcessHandle process = 0;
- base::LaunchProcess(*cmd_line, base::LaunchOptions(), &process);
+
+ static HANDLE hJobObject = NULL;
+ if (!hJobObject) {
+ hJobObject = CreateJobObject(NULL, NULL);
+ base::SetJobObjectAsKillOnJobClose(hJobObject);
+ }
+ options.job_handle = hJobObject;
+
+ base::LaunchProcess(*cmd_line, options, &process);
g_broker_services->AddTargetPeer(process);
return process;
}