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

Side by Side Diff: base/process/launch_win.cc

Issue 780653003: Revert of 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
« no previous file with comments | « base/process/launch.h ('k') | base/process/process_util_unittest.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 #include "base/process/launch.h" 5 #include "base/process/launch.h"
6 6
7 #include <fcntl.h> 7 #include <fcntl.h>
8 #include <io.h> 8 #include <io.h>
9 #include <shellapi.h> 9 #include <shellapi.h>
10 #include <windows.h> 10 #include <windows.h>
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 if (options.wait) 225 if (options.wait)
226 WaitForSingleObject(process_info.process_handle(), INFINITE); 226 WaitForSingleObject(process_info.process_handle(), INFINITE);
227 227
228 // If the caller wants the process handle, we won't close it. 228 // If the caller wants the process handle, we won't close it.
229 if (process_handle) 229 if (process_handle)
230 process_handle->Set(process_info.TakeProcessHandle()); 230 process_handle->Set(process_info.TakeProcessHandle());
231 231
232 return true; 232 return true;
233 } 233 }
234 234
235 // TODO(rvargas) crbug.com/416721: Remove this stub after LaunchProcess is
236 // fully migrated to use Process.
237 Process LaunchProcess(const string16& cmdline,
238 const LaunchOptions& options) {
239 win::ScopedHandle process_handle;
240 if (LaunchProcess(cmdline, options, &process_handle))
241 return Process(process_handle.Take());
242
243 return Process();
244 }
245
246 bool LaunchProcess(const CommandLine& cmdline, 235 bool LaunchProcess(const CommandLine& cmdline,
247 const LaunchOptions& options, 236 const LaunchOptions& options,
248 ProcessHandle* process_handle) { 237 ProcessHandle* process_handle) {
249 if (!process_handle) 238 if (!process_handle)
250 return LaunchProcess(cmdline.GetCommandLineString(), options, NULL); 239 return LaunchProcess(cmdline.GetCommandLineString(), options, NULL);
251 240
252 win::ScopedHandle process; 241 win::ScopedHandle process;
253 bool rv = LaunchProcess(cmdline.GetCommandLineString(), options, &process); 242 bool rv = LaunchProcess(cmdline.GetCommandLineString(), options, &process);
254 *process_handle = process.Take(); 243 *process_handle = process.Take();
255 return rv; 244 return rv;
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 WaitForSingleObject(proc_info.process_handle(), INFINITE); 364 WaitForSingleObject(proc_info.process_handle(), INFINITE);
376 365
377 return true; 366 return true;
378 } 367 }
379 368
380 void RaiseProcessToHighPriority() { 369 void RaiseProcessToHighPriority() {
381 SetPriorityClass(GetCurrentProcess(), HIGH_PRIORITY_CLASS); 370 SetPriorityClass(GetCurrentProcess(), HIGH_PRIORITY_CLASS);
382 } 371 }
383 372
384 } // namespace base 373 } // namespace base
OLDNEW
« no previous file with comments | « base/process/launch.h ('k') | base/process/process_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698