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

Unified Diff: base/process/kill_win.cc

Issue 368133002: Fixes for re-enabling more MSVC level 4 warnings: base/ edition (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix build, attempt 2 Created 6 years, 6 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/metrics/stats_table.cc ('k') | base/strings/safe_sprintf.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/process/kill_win.cc
diff --git a/base/process/kill_win.cc b/base/process/kill_win.cc
index aaf3f30a9368366e96bff76b823379e79752a699..17bc22685ac94b39cdceb21b762530c08512db36 100644
--- a/base/process/kill_win.cc
+++ b/base/process/kill_win.cc
@@ -200,12 +200,12 @@ bool WaitForExitCodeWithTimeout(ProcessHandle handle,
bool WaitForProcessesToExit(const FilePath::StringType& executable_name,
base::TimeDelta wait,
const ProcessFilter* filter) {
- const ProcessEntry* entry;
bool result = true;
DWORD start_time = GetTickCount();
NamedProcessIterator iter(executable_name, filter);
- while ((entry = iter.NextProcessEntry())) {
+ for (const ProcessEntry* entry = iter.NextProcessEntry(); entry;
+ entry = iter.NextProcessEntry()) {
DWORD remaining_wait = std::max<int64>(
0, wait.InMilliseconds() - (GetTickCount() - start_time));
HANDLE process = OpenProcess(SYNCHRONIZE,
@@ -213,7 +213,7 @@ bool WaitForProcessesToExit(const FilePath::StringType& executable_name,
entry->th32ProcessID);
DWORD wait_result = WaitForSingleObject(process, remaining_wait);
CloseHandle(process);
- result = result && (wait_result == WAIT_OBJECT_0);
+ result &= (wait_result == WAIT_OBJECT_0);
}
return result;
@@ -221,19 +221,17 @@ bool WaitForProcessesToExit(const FilePath::StringType& executable_name,
bool WaitForSingleProcess(ProcessHandle handle, base::TimeDelta wait) {
int exit_code;
- if (!WaitForExitCodeWithTimeout(handle, &exit_code, wait))
- return false;
- return exit_code == 0;
+ return WaitForExitCodeWithTimeout(handle, &exit_code, wait) && exit_code == 0;
}
bool CleanupProcesses(const FilePath::StringType& executable_name,
base::TimeDelta wait,
int exit_code,
const ProcessFilter* filter) {
- bool exited_cleanly = WaitForProcessesToExit(executable_name, wait, filter);
- if (!exited_cleanly)
- KillProcesses(executable_name, exit_code, filter);
- return exited_cleanly;
+ if (WaitForProcessesToExit(executable_name, wait, filter))
+ return true;
+ KillProcesses(executable_name, exit_code, filter);
+ return false;
}
void EnsureProcessTerminated(ProcessHandle process) {
« no previous file with comments | « base/metrics/stats_table.cc ('k') | base/strings/safe_sprintf.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698