OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 <set> | 10 #include <set> |
11 #include <string> | 11 #include <string> |
12 #include <utility> | 12 #include <utility> |
13 #include <vector> | 13 #include <vector> |
14 | 14 |
15 #include "base/base_export.h" | 15 #include "base/base_export.h" |
16 #include "base/basictypes.h" | 16 #include "base/basictypes.h" |
17 #include "base/environment.h" | 17 #include "base/environment.h" |
18 #include "base/process/process_handle.h" | 18 #include "base/process/process_handle.h" |
19 | 19 |
20 #if defined(OS_POSIX) | 20 #if defined(OS_POSIX) |
21 #include "base/posix/file_descriptor_shuffle.h" | 21 #include "base/posix/file_descriptor_shuffle.h" |
22 #elif defined(OS_WIN) | 22 #elif defined(OS_WIN) |
23 #include <windows.h> | 23 #include <windows.h> |
| 24 #include "base/win/scoped_handle.h" |
24 #endif | 25 #endif |
25 | 26 |
26 class CommandLine; | 27 class CommandLine; |
27 | 28 |
28 namespace base { | 29 namespace base { |
29 | 30 |
30 typedef std::vector<std::pair<int, int> > FileHandleMappingVector; | 31 typedef std::vector<std::pair<int, int> > FileHandleMappingVector; |
31 | 32 |
32 // Options for launching a subprocess that are passed to LaunchProcess(). | 33 // Options for launching a subprocess that are passed to LaunchProcess(). |
33 // The default constructor constructs the object with default options. | 34 // The default constructor constructs the object with default options. |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 // command line arguments directly, but prefer the CommandLine version | 140 // command line arguments directly, but prefer the CommandLine version |
140 // if launching Chrome itself. | 141 // if launching Chrome itself. |
141 // | 142 // |
142 // The first command line argument should be the path to the process, | 143 // The first command line argument should be the path to the process, |
143 // and don't forget to quote it. | 144 // and don't forget to quote it. |
144 // | 145 // |
145 // Example (including literal quotes) | 146 // Example (including literal quotes) |
146 // cmdline = "c:\windows\explorer.exe" -foo "c:\bar\" | 147 // cmdline = "c:\windows\explorer.exe" -foo "c:\bar\" |
147 BASE_EXPORT bool LaunchProcess(const string16& cmdline, | 148 BASE_EXPORT bool LaunchProcess(const string16& cmdline, |
148 const LaunchOptions& options, | 149 const LaunchOptions& options, |
149 ProcessHandle* process_handle); | 150 win::ScopedHandle* process_handle); |
150 | 151 |
151 #elif defined(OS_POSIX) | 152 #elif defined(OS_POSIX) |
152 // A POSIX-specific version of LaunchProcess that takes an argv array | 153 // A POSIX-specific version of LaunchProcess that takes an argv array |
153 // instead of a CommandLine. Useful for situations where you need to | 154 // instead of a CommandLine. Useful for situations where you need to |
154 // control the command line arguments directly, but prefer the | 155 // control the command line arguments directly, but prefer the |
155 // CommandLine version if launching Chrome itself. | 156 // CommandLine version if launching Chrome itself. |
156 BASE_EXPORT bool LaunchProcess(const std::vector<std::string>& argv, | 157 BASE_EXPORT bool LaunchProcess(const std::vector<std::string>& argv, |
157 const LaunchOptions& options, | 158 const LaunchOptions& options, |
158 ProcessHandle* process_handle); | 159 ProcessHandle* process_handle); |
159 | 160 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 // instance running inside the parent. The parent's Breakpad instance should | 212 // instance running inside the parent. The parent's Breakpad instance should |
212 // not handle the child's exceptions. Calling RestoreDefaultExceptionHandler | 213 // not handle the child's exceptions. Calling RestoreDefaultExceptionHandler |
213 // in the child after forking will restore the standard exception handler. | 214 // in the child after forking will restore the standard exception handler. |
214 // See http://crbug.com/20371/ for more details. | 215 // See http://crbug.com/20371/ for more details. |
215 void RestoreDefaultExceptionHandler(); | 216 void RestoreDefaultExceptionHandler(); |
216 #endif // defined(OS_MACOSX) | 217 #endif // defined(OS_MACOSX) |
217 | 218 |
218 } // namespace base | 219 } // namespace base |
219 | 220 |
220 #endif // BASE_PROCESS_LAUNCH_H_ | 221 #endif // BASE_PROCESS_LAUNCH_H_ |
OLD | NEW |