OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 <dirent.h> | 5 #include <dirent.h> |
6 #include <errno.h> | 6 #include <errno.h> |
7 #include <fcntl.h> | 7 #include <fcntl.h> |
8 #include <signal.h> | 8 #include <signal.h> |
9 #include <stdlib.h> | 9 #include <stdlib.h> |
10 #include <sys/resource.h> | 10 #include <sys/resource.h> |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 return WIFEXITED(status); | 241 return WIFEXITED(status); |
242 else | 242 else |
243 return false; | 243 return false; |
244 } | 244 } |
245 | 245 |
246 bool CrashAwareSleep(ProcessHandle handle, int wait_milliseconds) { | 246 bool CrashAwareSleep(ProcessHandle handle, int wait_milliseconds) { |
247 int status = WaitpidWithTimeout(handle, wait_milliseconds); | 247 int status = WaitpidWithTimeout(handle, wait_milliseconds); |
248 if (status != -1) | 248 if (status != -1) |
249 return !(WIFEXITED(status) || WIFSIGNALED(status)); | 249 return !(WIFEXITED(status) || WIFSIGNALED(status)); |
250 else | 250 else |
251 return false; | 251 return true; |
252 } | 252 } |
253 | 253 |
254 namespace { | 254 namespace { |
255 | 255 |
256 int64 TimeValToMicroseconds(const struct timeval& tv) { | 256 int64 TimeValToMicroseconds(const struct timeval& tv) { |
257 return tv.tv_sec * kMicrosecondsPerSecond + tv.tv_usec; | 257 return tv.tv_sec * kMicrosecondsPerSecond + tv.tv_usec; |
258 } | 258 } |
259 | 259 |
260 } | 260 } |
261 | 261 |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 const ProcessFilter* filter) { | 348 const ProcessFilter* filter) { |
349 bool exited_cleanly = | 349 bool exited_cleanly = |
350 WaitForProcessesToExit(executable_name, wait_milliseconds, | 350 WaitForProcessesToExit(executable_name, wait_milliseconds, |
351 filter); | 351 filter); |
352 if (!exited_cleanly) | 352 if (!exited_cleanly) |
353 KillProcesses(executable_name, exit_code, filter); | 353 KillProcesses(executable_name, exit_code, filter); |
354 return exited_cleanly; | 354 return exited_cleanly; |
355 } | 355 } |
356 | 356 |
357 } // namespace base | 357 } // namespace base |
OLD | NEW |