[go: nahoru, domu]

Extract similar code into SetJobObjectAsKillOnJobClose()

For now, Chromium have five same code in various place to handle JobObject
as KILL_ON_JOB_CLOSE.
This change provide a common utility function to be used by them.

BUG=n/a
TEST=n/a; run existing unit tests because this is just a refactoring change

Review URL: http://codereview.chromium.org/8667006

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@111441 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/base/process_util.h b/base/process_util.h
index 874e656..3c9dfbe 100644
--- a/base/process_util.h
+++ b/base/process_util.h
@@ -383,6 +383,15 @@
 #endif  // defined(OS_MACOSX)
 #endif  // defined(OS_POSIX)
 
+#if defined(OS_WIN)
+// Set JOBOBJECT_EXTENDED_LIMIT_INFORMATION to JobObject |job_object|.
+// As its limit_info.BasicLimitInformation.LimitFlags has
+// JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE.
+// When the provide JobObject |job_object| is closed, the binded process will
+// be terminated.
+BASE_EXPORT bool SetJobObjectAsKillOnJobClose(HANDLE job_object);
+#endif  // defined(OS_WIN)
+
 // Executes the application specified by |cl| and wait for it to exit. Stores
 // the output (stdout) in |output|. Redirects stderr to /dev/null. Returns true
 // on success (application launched and exited cleanly, with exit code