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 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 |
606 return result; | 606 return result; |
607 } | 607 } |
608 | 608 |
609 bool WaitForSingleProcess(ProcessHandle handle, int64 wait_milliseconds) { | 609 bool WaitForSingleProcess(ProcessHandle handle, int64 wait_milliseconds) { |
610 bool retval = WaitForSingleObject(handle, wait_milliseconds) == WAIT_OBJECT_0; | 610 int exit_code; |
611 return retval; | 611 if (!WaitForExitCodeWithTimeout(handle, &exit_code, wait_milliseconds)) |
612 return false; | |
613 return exit_code == 0; | |
Reid Kleckner
2011/12/15 22:14:19
This has slightly different semantics from the POS
bruening
2011/12/16 04:08:06
The problem is that on Windows exit codes set by t
Reid Kleckner
2011/12/20 23:43:24
I was going to say that the same thing can happen
| |
612 } | 614 } |
613 | 615 |
614 bool CleanupProcesses(const std::wstring& executable_name, | 616 bool CleanupProcesses(const std::wstring& executable_name, |
615 int64 wait_milliseconds, | 617 int64 wait_milliseconds, |
616 int exit_code, | 618 int exit_code, |
617 const ProcessFilter* filter) { | 619 const ProcessFilter* filter) { |
618 bool exited_cleanly = WaitForProcessesToExit(executable_name, | 620 bool exited_cleanly = WaitForProcessesToExit(executable_name, |
619 wait_milliseconds, | 621 wait_milliseconds, |
620 filter); | 622 filter); |
621 if (!exited_cleanly) | 623 if (!exited_cleanly) |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
990 | 992 |
991 PERFORMANCE_INFORMATION info; | 993 PERFORMANCE_INFORMATION info; |
992 if (!InternalGetPerformanceInfo(&info, sizeof(info))) { | 994 if (!InternalGetPerformanceInfo(&info, sizeof(info))) { |
993 DLOG(ERROR) << "Failed to fetch internal performance info."; | 995 DLOG(ERROR) << "Failed to fetch internal performance info."; |
994 return 0; | 996 return 0; |
995 } | 997 } |
996 return (info.CommitTotal * system_info.dwPageSize) / 1024; | 998 return (info.CommitTotal * system_info.dwPageSize) / 1024; |
997 } | 999 } |
998 | 1000 |
999 } // namespace base | 1001 } // namespace base |
OLD | NEW |