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