Index: base/process/launch.h |
diff --git a/base/process/launch.h b/base/process/launch.h |
index 0450ddf021e0faa7936bf7118951d050e185251b..a8f681f2a3bd8ba1c82701a27af66271d1014dec 100644 |
--- a/base/process/launch.h |
+++ b/base/process/launch.h |
@@ -13,6 +13,7 @@ |
#include "base/base_export.h" |
#include "base/basictypes.h" |
+#include "base/callback.h" |
#include "base/environment.h" |
#include "base/process/process.h" |
#include "base/process/process_handle.h" |
@@ -37,6 +38,19 @@ 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: |
+ virtual ~PreExecDelegate() {} |
jln (very slow on Chromium)
2015/01/07 00:40:37
Style: add trivial constructor
rickyz (no longer on Chrome)
2015/01/07 01:39:07
Done.
|
+ |
+ // Since this is to be run between fork and exec, and fork may have happened |
+ // while multiple threads were running, this code needs to be async safe. |
+ virtual void RunAsyncSafe() = 0; |
+ }; |
jln (very slow on Chromium)
2015/01/07 00:40:37
Style: DISALLOW_COPY_AND_ASSIGN
rickyz (no longer on Chrome)
2015/01/07 01:39:06
Done.
|
+#endif |
jln (very slow on Chromium)
2015/01/07 00:40:37
style: // defined(OS_POSIX)
rickyz (no longer on Chrome)
2015/01/07 01:39:06
Done.
|
+ |
LaunchOptions(); |
~LaunchOptions(); |
@@ -122,6 +136,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, this essentially needs to be async-signal |
jln (very slow on Chromium)
2015/01/07 00:40:37
s/this/"code running in this delegate"
rickyz (no longer on Chrome)
2015/01/07 01:39:07
Done.
|
+ // safe. |
+ PreExecDelegate* pre_exec_delegate; |
jln (very slow on Chromium)
2015/01/07 00:40:37
scoped_ptr?
mdempsky
2015/01/07 01:03:50
scoped_ptr would mean the LaunchOptions take owner
rickyz (no longer on Chrome)
2015/01/07 01:39:07
scoped_ptr doesn't work here because we make copie
mdempsky
2015/01/07 02:12:59
It seems intuitive to me that if you reuse the sam
|
+#endif |
+ |
#if defined(OS_CHROMEOS) |
// If non-negative, the specified file descriptor will be set as the launched |
// process' controlling terminal. |