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_util.h" | 5 #include "base/process_util.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 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 &startup_info, &process_info)) { | 342 &startup_info, &process_info)) { |
343 return false; | 343 return false; |
344 } | 344 } |
345 } | 345 } |
346 | 346 |
347 if (options.job_handle) { | 347 if (options.job_handle) { |
348 if (0 == AssignProcessToJobObject(options.job_handle, | 348 if (0 == AssignProcessToJobObject(options.job_handle, |
349 process_info.hProcess)) { | 349 process_info.hProcess)) { |
350 DLOG(ERROR) << "Could not AssignProcessToObject."; | 350 DLOG(ERROR) << "Could not AssignProcessToObject."; |
351 KillProcess(process_info.hProcess, kProcessKilledExitCode, true); | 351 KillProcess(process_info.hProcess, kProcessKilledExitCode, true); |
| 352 CloseHandle(process_info.hProcess); |
| 353 CloseHandle(process_info.hThread); |
352 return false; | 354 return false; |
353 } | 355 } |
354 | 356 |
355 ResumeThread(process_info.hThread); | 357 ResumeThread(process_info.hThread); |
356 } | 358 } |
357 | 359 |
358 // Handles must be closed or they will leak. | 360 // Handles must be closed or they will leak. |
359 CloseHandle(process_info.hThread); | 361 CloseHandle(process_info.hThread); |
360 | 362 |
361 if (options.wait) | 363 if (options.wait) |
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1002 | 1004 |
1003 PERFORMANCE_INFORMATION info; | 1005 PERFORMANCE_INFORMATION info; |
1004 if (!InternalGetPerformanceInfo(&info, sizeof(info))) { | 1006 if (!InternalGetPerformanceInfo(&info, sizeof(info))) { |
1005 DLOG(ERROR) << "Failed to fetch internal performance info."; | 1007 DLOG(ERROR) << "Failed to fetch internal performance info."; |
1006 return 0; | 1008 return 0; |
1007 } | 1009 } |
1008 return (info.CommitTotal * system_info.dwPageSize) / 1024; | 1010 return (info.CommitTotal * system_info.dwPageSize) / 1024; |
1009 } | 1011 } |
1010 | 1012 |
1011 } // namespace base | 1013 } // namespace base |
OLD | NEW |