Index: base/process/launch.h |
diff --git a/base/process/launch.h b/base/process/launch.h |
index 0450ddf021e0faa7936bf7118951d050e185251b..ff26225ee51e37caa4fd55fac6f1480dc3552c6a 100644 |
--- a/base/process/launch.h |
+++ b/base/process/launch.h |
@@ -37,6 +37,24 @@ typedef std::vector<std::pair<int, int> > FileHandleMappingVector; |
// Options for launching a subprocess that are passed to LaunchProcess(). |
// The default constructor constructs the object with default options. |
struct BASE_EXPORT LaunchOptions { |
+#if defined(OS_POSIX) |
+ // Delegate to be run in between fork and exec in the subprocess (see |
+ // pre_exec_delegate below) |
+ class BASE_EXPORT PreExecDelegate { |
+ public: |
+ PreExecDelegate() {} |
+ virtual ~PreExecDelegate() {} |
+ |
+ // Since this is to be run between fork and exec, and fork may have happened |
+ // while multiple threads were running, this function needs to be async |
+ // safe. |
+ virtual void RunAsyncSafe() = 0; |
+ |
+ private: |
+ DISALLOW_COPY_AND_ASSIGN(PreExecDelegate); |
+ }; |
+#endif // defined(OS_POSIX) |
+ |
LaunchOptions(); |
~LaunchOptions(); |
@@ -122,6 +140,14 @@ struct BASE_EXPORT LaunchOptions { |
bool allow_new_privs; |
#endif // defined(OS_LINUX) |
+#if defined(OS_POSIX) |
+ // If non-null, a delegate to be run immediately prior to executing the new |
+ // program in the child process. Warning: If LaunchProcess was called in the |
+ // presence of multiple threads, code running in this delegate essentially |
+ // needs to be async-signal safe. |
Lei Zhang
2015/01/08 23:07:07
Maybe mention "man 7 signal" for a list of async s
rickyz (no longer on Chrome)
2015/01/13 17:22:36
Done.
|
+ PreExecDelegate* pre_exec_delegate; |
+#endif // defined(OS_POSIX) |
+ |
#if defined(OS_CHROMEOS) |
// If non-negative, the specified file descriptor will be set as the launched |
// process' controlling terminal. |