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

Side by Side Diff: base/process_util.h

Issue 11419267: Add stdin_handle and stdout_handle in base::LaunchOptions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | base/process_util_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/namespace contains utility functions for enumerating, ending and 5 // This file/namespace contains utility functions for enumerating, ending and
6 // computing statistics of processes. 6 // computing statistics of processes.
7 7
8 #ifndef BASE_PROCESS_UTIL_H_ 8 #ifndef BASE_PROCESS_UTIL_H_
9 #define BASE_PROCESS_UTIL_H_ 9 #define BASE_PROCESS_UTIL_H_
10 10
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 typedef int* LaunchSynchronizationHandle; 233 typedef int* LaunchSynchronizationHandle;
234 #endif // defined(OS_MACOSX) 234 #endif // defined(OS_MACOSX)
235 235
236 // Options for launching a subprocess that are passed to LaunchProcess(). 236 // Options for launching a subprocess that are passed to LaunchProcess().
237 // The default constructor constructs the object with default options. 237 // The default constructor constructs the object with default options.
238 struct LaunchOptions { 238 struct LaunchOptions {
239 LaunchOptions() : wait(false), 239 LaunchOptions() : wait(false),
240 #if defined(OS_WIN) 240 #if defined(OS_WIN)
241 start_hidden(false), inherit_handles(false), as_user(NULL), 241 start_hidden(false), inherit_handles(false), as_user(NULL),
242 empty_desktop_name(false), job_handle(NULL), 242 empty_desktop_name(false), job_handle(NULL),
243 stdin_handle(NULL),
244 stdout_handle(NULL),
245 stderr_handle(NULL),
243 force_breakaway_from_job_(false) 246 force_breakaway_from_job_(false)
244 #else 247 #else
245 environ(NULL), fds_to_remap(NULL), maximize_rlimits(NULL), 248 environ(NULL), fds_to_remap(NULL), maximize_rlimits(NULL),
246 new_process_group(false) 249 new_process_group(false)
247 #if defined(OS_LINUX) 250 #if defined(OS_LINUX)
248 , clone_flags(0) 251 , clone_flags(0)
249 #endif // OS_LINUX 252 #endif // OS_LINUX
250 #if defined(OS_CHROMEOS) 253 #if defined(OS_CHROMEOS)
251 , ctrl_terminal_fd(-1) 254 , ctrl_terminal_fd(-1)
252 #endif // OS_CHROMEOS 255 #endif // OS_CHROMEOS
253 #if defined(OS_MACOSX) 256 #if defined(OS_MACOSX)
254 , synchronize(NULL) 257 , synchronize(NULL)
255 #endif // defined(OS_MACOSX) 258 #endif // defined(OS_MACOSX)
256 #endif // !defined(OS_WIN) 259 #endif // !defined(OS_WIN)
257 {} 260 {}
258 261
259 // If true, wait for the process to complete. 262 // If true, wait for the process to complete.
260 bool wait; 263 bool wait;
261 264
262 #if defined(OS_WIN) 265 #if defined(OS_WIN)
263 bool start_hidden; 266 bool start_hidden;
264 267
265 // If true, the new process inherits handles from the parent. 268 // If true, the new process inherits handles from the parent. In production
269 // code this flag should be used only when running short-lived, trusted
270 // binaries, because open handles from other libraries and subsystems will
271 // leak to the child process, causing errors such as open socket hangs.
266 bool inherit_handles; 272 bool inherit_handles;
267 273
268 // If non-NULL, runs as if the user represented by the token had launched it. 274 // If non-NULL, runs as if the user represented by the token had launched it.
269 // Whether the application is visible on the interactive desktop depends on 275 // Whether the application is visible on the interactive desktop depends on
270 // the token belonging to an interactive logon session. 276 // the token belonging to an interactive logon session.
271 // 277 //
272 // To avoid hard to diagnose problems, when specified this loads the 278 // To avoid hard to diagnose problems, when specified this loads the
273 // environment variables associated with the user and if this operation fails 279 // environment variables associated with the user and if this operation fails
274 // the entire call fails as well. 280 // the entire call fails as well.
275 UserTokenHandle as_user; 281 UserTokenHandle as_user;
276 282
277 // If true, use an empty string for the desktop name. 283 // If true, use an empty string for the desktop name.
278 bool empty_desktop_name; 284 bool empty_desktop_name;
279 285
280 // If non-NULL, launches the application in that job object. The process will 286 // If non-NULL, launches the application in that job object. The process will
281 // be terminated immediately and LaunchProcess() will fail if assignment to 287 // be terminated immediately and LaunchProcess() will fail if assignment to
282 // the job object fails. 288 // the job object fails.
283 HANDLE job_handle; 289 HANDLE job_handle;
284 290
291 // Handles for the redirection of stdin, stdout and stderr. The handles must
292 // be inheritable. Caller should either set all three of them or none (i.e.
293 // there is no way to redirect stderr without redirecting stdin). The
294 // |inherit_handles| flag must be set to true when redirecting stdio stream.
295 HANDLE stdin_handle;
296 HANDLE stdout_handle;
297 HANDLE stderr_handle;
298
285 // If set to true, ensures that the child process is launched with the 299 // If set to true, ensures that the child process is launched with the
286 // CREATE_BREAKAWAY_FROM_JOB flag which allows it to breakout of the parent 300 // CREATE_BREAKAWAY_FROM_JOB flag which allows it to breakout of the parent
287 // job if any. 301 // job if any.
288 bool force_breakaway_from_job_; 302 bool force_breakaway_from_job_;
289 #else 303 #else
290 // If non-NULL, set/unset environment variables. 304 // If non-NULL, set/unset environment variables.
291 // See documentation of AlterEnvironment(). 305 // See documentation of AlterEnvironment().
292 // This pointer is owned by the caller and must live through the 306 // This pointer is owned by the caller and must live through the
293 // call to LaunchProcess(). 307 // call to LaunchProcess().
294 const EnvironmentVector* environ; 308 const EnvironmentVector* environ;
(...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after
883 // YOUR CODE IS LIKELY TO BE REVERTED. THANK YOU. 897 // YOUR CODE IS LIKELY TO BE REVERTED. THANK YOU.
884 // 898 //
885 // TODO(shess): Weird place to put it, but this is where the OOM 899 // TODO(shess): Weird place to put it, but this is where the OOM
886 // killer currently lives. 900 // killer currently lives.
887 BASE_EXPORT void* UncheckedMalloc(size_t size); 901 BASE_EXPORT void* UncheckedMalloc(size_t size);
888 #endif // defined(OS_MACOSX) 902 #endif // defined(OS_MACOSX)
889 903
890 } // namespace base 904 } // namespace base
891 905
892 #endif // BASE_PROCESS_UTIL_H_ 906 #endif // BASE_PROCESS_UTIL_H_
OLDNEW
« no previous file with comments | « no previous file | base/process_util_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698