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

Side by Side Diff: base/process_util.h

Issue 9689081: Add comments and fix a potential leak in LaunchProcess. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Missing matching call to CloseHandle(hThread) Created 8 years, 9 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 #pragma once 10 #pragma once
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 // the token belonging to an interactive logon session. 252 // the token belonging to an interactive logon session.
253 // 253 //
254 // To avoid hard to diagnose problems, when specified this loads the 254 // To avoid hard to diagnose problems, when specified this loads the
255 // environment variables associated with the user and if this operation fails 255 // environment variables associated with the user and if this operation fails
256 // the entire call fails as well. 256 // the entire call fails as well.
257 UserTokenHandle as_user; 257 UserTokenHandle as_user;
258 258
259 // If true, use an empty string for the desktop name. 259 // If true, use an empty string for the desktop name.
260 bool empty_desktop_name; 260 bool empty_desktop_name;
261 261
262 // If non-NULL, launches the application in that job object. 262 // If non-NULL, launches the application in that job object. The process will
263 // be terminated immediately and LaunchProcess() will fail if assignment to
264 // the job object fails.
263 HANDLE job_handle; 265 HANDLE job_handle;
264 #else 266 #else
265 // If non-NULL, set/unset environment variables. 267 // If non-NULL, set/unset environment variables.
266 // See documentation of AlterEnvironment(). 268 // See documentation of AlterEnvironment().
267 // This pointer is owned by the caller and must live through the 269 // This pointer is owned by the caller and must live through the
268 // call to LaunchProcess(). 270 // call to LaunchProcess().
269 const EnvironmentVector* environ; 271 const EnvironmentVector* environ;
270 272
271 // If non-NULL, remap file descriptors according to the mapping of 273 // If non-NULL, remap file descriptors according to the mapping of
272 // src fd->dest fd to propagate FDs into the child process. 274 // src fd->dest fd to propagate FDs into the child process.
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 // |synchronize| and |wait| must not both be set simultaneously. 317 // |synchronize| and |wait| must not both be set simultaneously.
316 LaunchSynchronizationHandle* synchronize; 318 LaunchSynchronizationHandle* synchronize;
317 #endif // defined(OS_MACOSX) 319 #endif // defined(OS_MACOSX)
318 320
319 #endif // !defined(OS_WIN) 321 #endif // !defined(OS_WIN)
320 }; 322 };
321 323
322 // Launch a process via the command line |cmdline|. 324 // Launch a process via the command line |cmdline|.
323 // See the documentation of LaunchOptions for details on |options|. 325 // See the documentation of LaunchOptions for details on |options|.
324 // 326 //
325 // If |process_handle| is non-NULL, it will be filled in with the 327 // Returns true upon success.
328 //
329 // Upon success, if |process_handle| is non-NULL, it will be filled in with the
326 // handle of the launched process. NOTE: In this case, the caller is 330 // handle of the launched process. NOTE: In this case, the caller is
327 // responsible for closing the handle so that it doesn't leak! 331 // responsible for closing the handle so that it doesn't leak!
328 // Otherwise, the process handle will be implicitly closed. 332 // Otherwise, the process handle will be implicitly closed.
329 // 333 //
330 // Unix-specific notes: 334 // Unix-specific notes:
331 // - All file descriptors open in the parent process will be closed in the 335 // - All file descriptors open in the parent process will be closed in the
332 // child process except for any preserved by options::fds_to_remap, and 336 // child process except for any preserved by options::fds_to_remap, and
333 // stdin, stdout, and stderr. If not remapped by options::fds_to_remap, 337 // stdin, stdout, and stderr. If not remapped by options::fds_to_remap,
334 // stdin is reopened as /dev/null, and the child is allowed to inherit its 338 // stdin is reopened as /dev/null, and the child is allowed to inherit its
335 // parent's stdout and stderr. 339 // parent's stdout and stderr.
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after
827 // instance running inside the parent. The parent's Breakpad instance should 831 // instance running inside the parent. The parent's Breakpad instance should
828 // not handle the child's exceptions. Calling RestoreDefaultExceptionHandler 832 // not handle the child's exceptions. Calling RestoreDefaultExceptionHandler
829 // in the child after forking will restore the standard exception handler. 833 // in the child after forking will restore the standard exception handler.
830 // See http://crbug.com/20371/ for more details. 834 // See http://crbug.com/20371/ for more details.
831 void RestoreDefaultExceptionHandler(); 835 void RestoreDefaultExceptionHandler();
832 #endif // defined(OS_MACOSX) 836 #endif // defined(OS_MACOSX)
833 837
834 } // namespace base 838 } // namespace base
835 839
836 #endif // BASE_PROCESS_UTIL_H_ 840 #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