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

Side by Side Diff: base/process/launch.h

Issue 831363002: Add the ability to run a callback between fork and exec. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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 unified diff | Download patch
« no previous file with comments | « no previous file | base/process/launch_posix.cc » ('j') | base/process/process_unittest.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // This file contains functions for launching subprocesses. 5 // This file contains functions for launching subprocesses.
6 6
7 #ifndef BASE_PROCESS_LAUNCH_H_ 7 #ifndef BASE_PROCESS_LAUNCH_H_
8 #define BASE_PROCESS_LAUNCH_H_ 8 #define BASE_PROCESS_LAUNCH_H_
9 9
10 #include <string> 10 #include <string>
11 #include <utility> 11 #include <utility>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/base_export.h" 14 #include "base/base_export.h"
15 #include "base/basictypes.h" 15 #include "base/basictypes.h"
16 #include "base/callback.h"
16 #include "base/environment.h" 17 #include "base/environment.h"
17 #include "base/process/process.h" 18 #include "base/process/process.h"
18 #include "base/process/process_handle.h" 19 #include "base/process/process_handle.h"
19 #include "base/strings/string_piece.h" 20 #include "base/strings/string_piece.h"
20 21
21 #if defined(OS_POSIX) 22 #if defined(OS_POSIX)
22 #include "base/posix/file_descriptor_shuffle.h" 23 #include "base/posix/file_descriptor_shuffle.h"
23 #elif defined(OS_WIN) 24 #elif defined(OS_WIN)
24 #include <windows.h> 25 #include <windows.h>
25 #endif 26 #endif
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 116
116 #if defined(OS_LINUX) 117 #if defined(OS_LINUX)
117 // If non-zero, start the process using clone(), using flags as provided. 118 // If non-zero, start the process using clone(), using flags as provided.
118 int clone_flags; 119 int clone_flags;
119 120
120 // By default, child processes will have the PR_SET_NO_NEW_PRIVS bit set. If 121 // By default, child processes will have the PR_SET_NO_NEW_PRIVS bit set. If
121 // true, then this bit will not be set in the new child process. 122 // true, then this bit will not be set in the new child process.
122 bool allow_new_privs; 123 bool allow_new_privs;
123 #endif // defined(OS_LINUX) 124 #endif // defined(OS_LINUX)
124 125
126 #if defined(OS_POSIX)
127 // A callback to be run in immediately prior to executing the new program in
128 // the child process. Warning: If LaunchProcess was called in the presence of
129 // multiple threads, it may not be safe for this callback to perform
130 // allocations or grab locks.
131 Closure pre_exec_hook;
jln (very slow on Chromium) 2015/01/06 00:43:36 If we go this route, we should make the warning ev
132 #endif
133
125 #if defined(OS_CHROMEOS) 134 #if defined(OS_CHROMEOS)
126 // If non-negative, the specified file descriptor will be set as the launched 135 // If non-negative, the specified file descriptor will be set as the launched
127 // process' controlling terminal. 136 // process' controlling terminal.
128 int ctrl_terminal_fd; 137 int ctrl_terminal_fd;
129 #endif // defined(OS_CHROMEOS) 138 #endif // defined(OS_CHROMEOS)
130 139
131 #if defined(OS_MACOSX) 140 #if defined(OS_MACOSX)
132 // If this name is non-empty, the new child, after fork() but before exec(), 141 // If this name is non-empty, the new child, after fork() but before exec(),
133 // will look up this server name in the bootstrap namespace. The resulting 142 // will look up this server name in the bootstrap namespace. The resulting
134 // service port will be replaced as the bootstrap port in the child. Because 143 // service port will be replaced as the bootstrap port in the child. Because
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 void ReplaceBootstrapPort(const std::string& replacement_bootstrap_name); 272 void ReplaceBootstrapPort(const std::string& replacement_bootstrap_name);
264 #endif // defined(OS_MACOSX) 273 #endif // defined(OS_MACOSX)
265 274
266 // Creates a LaunchOptions object suitable for launching processes in a test 275 // Creates a LaunchOptions object suitable for launching processes in a test
267 // binary. This should not be called in production/released code. 276 // binary. This should not be called in production/released code.
268 BASE_EXPORT LaunchOptions LaunchOptionsForTest(); 277 BASE_EXPORT LaunchOptions LaunchOptionsForTest();
269 278
270 } // namespace base 279 } // namespace base
271 280
272 #endif // BASE_PROCESS_LAUNCH_H_ 281 #endif // BASE_PROCESS_LAUNCH_H_
OLDNEW
« no previous file with comments | « no previous file | base/process/launch_posix.cc » ('j') | base/process/process_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698