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

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

Issue 759903002: Upgrade the windows specific version of LaunchProcess to avoid raw handles. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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
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/environment.h" 16 #include "base/environment.h"
17 #include "base/process/process_handle.h" 17 #include "base/process/process_handle.h"
18 #include "base/strings/string_piece.h" 18 #include "base/strings/string_piece.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 #include "base/process/process.h"
25 #endif 25 #endif
26 26
27 namespace base { 27 namespace base {
28 28
29 class CommandLine; 29 class CommandLine;
30 30
31 #if defined(OS_WIN) 31 #if defined(OS_WIN)
32 typedef std::vector<HANDLE> HandlesToInheritVector; 32 typedef std::vector<HANDLE> HandlesToInheritVector;
33 #endif 33 #endif
34 // TODO(viettrungluu): Only define this on POSIX? 34 // TODO(viettrungluu): Only define this on POSIX?
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 // Windows-specific LaunchProcess that takes the command line as a 166 // Windows-specific LaunchProcess that takes the command line as a
167 // string. Useful for situations where you need to control the 167 // string. Useful for situations where you need to control the
168 // command line arguments directly, but prefer the CommandLine version 168 // command line arguments directly, but prefer the CommandLine version
169 // if launching Chrome itself. 169 // if launching Chrome itself.
170 // 170 //
171 // The first command line argument should be the path to the process, 171 // The first command line argument should be the path to the process,
172 // and don't forget to quote it. 172 // and don't forget to quote it.
173 // 173 //
174 // Example (including literal quotes) 174 // Example (including literal quotes)
175 // cmdline = "c:\windows\explorer.exe" -foo "c:\bar\" 175 // cmdline = "c:\windows\explorer.exe" -foo "c:\bar\"
176 BASE_EXPORT bool LaunchProcess(const string16& cmdline, 176 BASE_EXPORT Process LaunchProcess(const string16& cmdline,
177 const LaunchOptions& options, 177 const LaunchOptions& options);
178 win::ScopedHandle* process_handle);
179 178
180 // Launches a process with elevated privileges. This does not behave exactly 179 // Launches a process with elevated privileges. This does not behave exactly
181 // like LaunchProcess as it uses ShellExecuteEx instead of CreateProcess to 180 // like LaunchProcess as it uses ShellExecuteEx instead of CreateProcess to
182 // create the process. This means the process will have elevated privileges 181 // create the process. This means the process will have elevated privileges
183 // and thus some common operations like OpenProcess will fail. The process will 182 // and thus some common operations like OpenProcess will fail. The process will
184 // be available through the |process_handle| argument. Currently the only 183 // be available through the |process_handle| argument. Currently the only
185 // supported LaunchOptions are |start_hidden| and |wait|. 184 // supported LaunchOptions are |start_hidden| and |wait|.
186 BASE_EXPORT bool LaunchElevatedProcess(const CommandLine& cmdline, 185 BASE_EXPORT bool LaunchElevatedProcess(const CommandLine& cmdline,
187 const LaunchOptions& options, 186 const LaunchOptions& options,
188 ProcessHandle* process_handle); 187 ProcessHandle* process_handle);
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 void ReplaceBootstrapPort(const std::string& replacement_bootstrap_name); 265 void ReplaceBootstrapPort(const std::string& replacement_bootstrap_name);
267 #endif // defined(OS_MACOSX) 266 #endif // defined(OS_MACOSX)
268 267
269 // Creates a LaunchOptions object suitable for launching processes in a test 268 // Creates a LaunchOptions object suitable for launching processes in a test
270 // binary. This should not be called in production/released code. 269 // binary. This should not be called in production/released code.
271 BASE_EXPORT LaunchOptions LaunchOptionsForTest(); 270 BASE_EXPORT LaunchOptions LaunchOptionsForTest();
272 271
273 } // namespace base 272 } // namespace base
274 273
275 #endif // BASE_PROCESS_LAUNCH_H_ 274 #endif // BASE_PROCESS_LAUNCH_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698