| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 585 } | 585 } |
| 586 | 586 |
| 587 bool WaitForProcessesToExit(const std::wstring& executable_name, | 587 bool WaitForProcessesToExit(const std::wstring& executable_name, |
| 588 int64 wait_milliseconds, | 588 int64 wait_milliseconds, |
| 589 const ProcessFilter* filter) { | 589 const ProcessFilter* filter) { |
| 590 const ProcessEntry* entry; | 590 const ProcessEntry* entry; |
| 591 bool result = true; | 591 bool result = true; |
| 592 DWORD start_time = GetTickCount(); | 592 DWORD start_time = GetTickCount(); |
| 593 | 593 |
| 594 NamedProcessIterator iter(executable_name, filter); | 594 NamedProcessIterator iter(executable_name, filter); |
| 595 while (entry = iter.NextProcessEntry()) { | 595 while ((entry = iter.NextProcessEntry()) != NULL) { |
| 596 DWORD remaining_wait = | 596 DWORD remaining_wait = |
| 597 std::max<int64>(0, wait_milliseconds - (GetTickCount() - start_time)); | 597 std::max<int64>(0, wait_milliseconds - (GetTickCount() - start_time)); |
| 598 HANDLE process = OpenProcess(SYNCHRONIZE, | 598 HANDLE process = OpenProcess(SYNCHRONIZE, |
| 599 FALSE, | 599 FALSE, |
| 600 entry->th32ProcessID); | 600 entry->th32ProcessID); |
| 601 DWORD wait_result = WaitForSingleObject(process, remaining_wait); | 601 DWORD wait_result = WaitForSingleObject(process, remaining_wait); |
| 602 CloseHandle(process); | 602 CloseHandle(process); |
| 603 result = result && (wait_result == WAIT_OBJECT_0); | 603 result = result && (wait_result == WAIT_OBJECT_0); |
| 604 } | 604 } |
| 605 | 605 |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 990 | 990 |
| 991 PERFORMANCE_INFORMATION info; | 991 PERFORMANCE_INFORMATION info; |
| 992 if (!InternalGetPerformanceInfo(&info, sizeof(info))) { | 992 if (!InternalGetPerformanceInfo(&info, sizeof(info))) { |
| 993 DLOG(ERROR) << "Failed to fetch internal performance info."; | 993 DLOG(ERROR) << "Failed to fetch internal performance info."; |
| 994 return 0; | 994 return 0; |
| 995 } | 995 } |
| 996 return (info.CommitTotal * system_info.dwPageSize) / 1024; | 996 return (info.CommitTotal * system_info.dwPageSize) / 1024; |
| 997 } | 997 } |
| 998 | 998 |
| 999 } // namespace base | 999 } // namespace base |
| OLD | NEW |