OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 1209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1220 result = true; | 1220 result = true; |
1221 break; | 1221 break; |
1222 } | 1222 } |
1223 base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(100)); | 1223 base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(100)); |
1224 } while ((end_time - base::Time::Now()) > base::TimeDelta()); | 1224 } while ((end_time - base::Time::Now()) > base::TimeDelta()); |
1225 | 1225 |
1226 return result; | 1226 return result; |
1227 } | 1227 } |
1228 | 1228 |
1229 bool CleanupProcesses(const FilePath::StringType& executable_name, | 1229 bool CleanupProcesses(const FilePath::StringType& executable_name, |
1230 int64 wait_milliseconds, | 1230 base::TimeDelta wait, |
1231 int exit_code, | 1231 int exit_code, |
1232 const ProcessFilter* filter) { | 1232 const ProcessFilter* filter) { |
1233 bool exited_cleanly = | 1233 bool exited_cleanly = WaitForProcessesToExit(executable_name, wait, filter); |
1234 WaitForProcessesToExit( | |
1235 executable_name, | |
1236 base::TimeDelta::FromMilliseconds(wait_milliseconds), | |
1237 filter); | |
1238 if (!exited_cleanly) | 1234 if (!exited_cleanly) |
1239 KillProcesses(executable_name, exit_code, filter); | 1235 KillProcesses(executable_name, exit_code, filter); |
1240 return exited_cleanly; | 1236 return exited_cleanly; |
1241 } | 1237 } |
1242 | 1238 |
1243 #if !defined(OS_MACOSX) | 1239 #if !defined(OS_MACOSX) |
1244 | 1240 |
1245 namespace { | 1241 namespace { |
1246 | 1242 |
1247 // Return true if the given child is dead. This will also reap the process. | 1243 // Return true if the given child is dead. This will also reap the process. |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1331 if (IsChildDead(process)) | 1327 if (IsChildDead(process)) |
1332 return; | 1328 return; |
1333 | 1329 |
1334 BackgroundReaper* reaper = new BackgroundReaper(process, 0); | 1330 BackgroundReaper* reaper = new BackgroundReaper(process, 0); |
1335 PlatformThread::CreateNonJoinable(0, reaper); | 1331 PlatformThread::CreateNonJoinable(0, reaper); |
1336 } | 1332 } |
1337 | 1333 |
1338 #endif // !defined(OS_MACOSX) | 1334 #endif // !defined(OS_MACOSX) |
1339 | 1335 |
1340 } // namespace base | 1336 } // namespace base |
OLD | NEW |