OLD | NEW |
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 <windows.h> | 9 #include <windows.h> |
10 #include <userenv.h> | 10 #include <userenv.h> |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 | 188 |
189 return true; | 189 return true; |
190 } | 190 } |
191 | 191 |
192 bool LaunchProcess(const CommandLine& cmdline, | 192 bool LaunchProcess(const CommandLine& cmdline, |
193 const LaunchOptions& options, | 193 const LaunchOptions& options, |
194 ProcessHandle* process_handle) { | 194 ProcessHandle* process_handle) { |
195 return LaunchProcess(cmdline.GetCommandLineString(), options, process_handle); | 195 return LaunchProcess(cmdline.GetCommandLineString(), options, process_handle); |
196 } | 196 } |
197 | 197 |
198 bool SetJobObjectAsKillOnJobClose(HANDLE job_object) { | 198 bool SetJobObjectLimitFlags(HANDLE job_object, DWORD limit_flags) { |
199 JOBOBJECT_EXTENDED_LIMIT_INFORMATION limit_info = {0}; | 199 JOBOBJECT_EXTENDED_LIMIT_INFORMATION limit_info = {0}; |
200 limit_info.BasicLimitInformation.LimitFlags = | 200 limit_info.BasicLimitInformation.LimitFlags = limit_flags; |
201 JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE; | |
202 return 0 != SetInformationJobObject( | 201 return 0 != SetInformationJobObject( |
203 job_object, | 202 job_object, |
204 JobObjectExtendedLimitInformation, | 203 JobObjectExtendedLimitInformation, |
205 &limit_info, | 204 &limit_info, |
206 sizeof(limit_info)); | 205 sizeof(limit_info)); |
207 } | 206 } |
208 | 207 |
209 bool GetAppOutput(const CommandLine& cl, std::string* output) { | 208 bool GetAppOutput(const CommandLine& cl, std::string* output) { |
210 HANDLE out_read = NULL; | 209 HANDLE out_read = NULL; |
211 HANDLE out_write = NULL; | 210 HANDLE out_write = NULL; |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 WaitForSingleObject(proc_info.process_handle(), INFINITE); | 273 WaitForSingleObject(proc_info.process_handle(), INFINITE); |
275 | 274 |
276 return true; | 275 return true; |
277 } | 276 } |
278 | 277 |
279 void RaiseProcessToHighPriority() { | 278 void RaiseProcessToHighPriority() { |
280 SetPriorityClass(GetCurrentProcess(), HIGH_PRIORITY_CLASS); | 279 SetPriorityClass(GetCurrentProcess(), HIGH_PRIORITY_CLASS); |
281 } | 280 } |
282 | 281 |
283 } // namespace base | 282 } // namespace base |
OLD | NEW |