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

Unified Diff: base/process_util_posix.cc

Issue 10827112: base: Fix minor warnings reported by cppcheck. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix nit Created 8 years, 4 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/observer_list_unittest.cc ('k') | base/system_monitor/system_monitor_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/process_util_posix.cc
diff --git a/base/process_util_posix.cc b/base/process_util_posix.cc
index a6e816af4484eeeb545cded16f9e4dd25533a62b..9ea0e41e7167b12857b97d641839435e40697dcb 100644
--- a/base/process_util_posix.cc
+++ b/base/process_util_posix.cc
@@ -253,11 +253,7 @@ bool KillProcess(ProcessHandle process_id, int exit_code, bool wait) {
DCHECK_GT(process_id, 1) << " tried to kill invalid process_id";
if (process_id <= 1)
return false;
- static unsigned kMaxSleepMs = 1000;
- unsigned sleep_ms = 4;
-
bool result = kill(process_id, SIGTERM) == 0;
-
if (result && wait) {
int tries = 60;
@@ -267,6 +263,8 @@ bool KillProcess(ProcessHandle process_id, int exit_code, bool wait) {
tries *= 2;
}
+ unsigned sleep_ms = 4;
+
// The process may not end immediately due to pending I/O
bool exited = false;
while (tries-- > 0) {
@@ -286,6 +284,7 @@ bool KillProcess(ProcessHandle process_id, int exit_code, bool wait) {
}
usleep(sleep_ms * 1000);
+ const unsigned kMaxSleepMs = 1000;
if (sleep_ms < kMaxSleepMs)
sleep_ms *= 2;
}
« no previous file with comments | « base/observer_list_unittest.cc ('k') | base/system_monitor/system_monitor_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698