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

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

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: Fix chrome build 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
235 bool LaunchProcess(const CommandLine& cmdline, 246 bool LaunchProcess(const CommandLine& cmdline,
236 const LaunchOptions& options, 247 const LaunchOptions& options,
237 ProcessHandle* process_handle) { 248 ProcessHandle* process_handle) {
238 if (!process_handle) 249 if (!process_handle)
239 return LaunchProcess(cmdline.GetCommandLineString(), options, NULL); 250 return LaunchProcess(cmdline.GetCommandLineString(), options, NULL);
240 251
241 win::ScopedHandle process; 252 win::ScopedHandle process;
242 bool rv = LaunchProcess(cmdline.GetCommandLineString(), options, &process); 253 bool rv = LaunchProcess(cmdline.GetCommandLineString(), options, &process);
243 *process_handle = process.Take(); 254 *process_handle = process.Take();
244 return rv; 255 return rv;
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 WaitForSingleObject(proc_info.process_handle(), INFINITE); 375 WaitForSingleObject(proc_info.process_handle(), INFINITE);
365 376
366 return true; 377 return true;
367 } 378 }
368 379
369 void RaiseProcessToHighPriority() { 380 void RaiseProcessToHighPriority() {
370 SetPriorityClass(GetCurrentProcess(), HIGH_PRIORITY_CLASS); 381 SetPriorityClass(GetCurrentProcess(), HIGH_PRIORITY_CLASS);
371 } 382 }
372 383
373 } // namespace base 384 } // 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