| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 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/process.h" | 5 #include "base/process/process.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <sys/resource.h> | 9 #include <sys/resource.h> |
| 10 #include <sys/wait.h> | 10 #include <sys/wait.h> |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 result = kill(process_, SIGKILL) == 0; | 343 result = kill(process_, SIGKILL) == 0; |
| 344 } | 344 } |
| 345 | 345 |
| 346 if (!result) | 346 if (!result) |
| 347 DPLOG(ERROR) << "Unable to terminate process " << process_; | 347 DPLOG(ERROR) << "Unable to terminate process " << process_; |
| 348 | 348 |
| 349 return result; | 349 return result; |
| 350 } | 350 } |
| 351 #endif // !defined(OS_NACL_NONSFI) | 351 #endif // !defined(OS_NACL_NONSFI) |
| 352 | 352 |
| 353 bool Process::WaitForExit(int* exit_code) { | 353 bool Process::WaitForExit(int* exit_code) const { |
| 354 return WaitForExitWithTimeout(TimeDelta::Max(), exit_code); | 354 return WaitForExitWithTimeout(TimeDelta::Max(), exit_code); |
| 355 } | 355 } |
| 356 | 356 |
| 357 bool Process::WaitForExitWithTimeout(TimeDelta timeout, int* exit_code) { | 357 bool Process::WaitForExitWithTimeout(TimeDelta timeout, int* exit_code) const { |
| 358 // Record the event that this thread is blocking upon (for hang diagnosis). | 358 // Record the event that this thread is blocking upon (for hang diagnosis). |
| 359 base::debug::ScopedProcessWaitActivity process_activity(this); | 359 base::debug::ScopedProcessWaitActivity process_activity(this); |
| 360 | 360 |
| 361 return WaitForExitWithTimeoutImpl(Handle(), exit_code, timeout); | 361 return WaitForExitWithTimeoutImpl(Handle(), exit_code, timeout); |
| 362 } | 362 } |
| 363 | 363 |
| 364 #if !defined(OS_LINUX) && !defined(OS_MACOSX) | 364 #if !defined(OS_LINUX) && !defined(OS_MACOSX) |
| 365 bool Process::IsProcessBackgrounded() const { | 365 bool Process::IsProcessBackgrounded() const { |
| 366 // See SetProcessBackgrounded(). | 366 // See SetProcessBackgrounded(). |
| 367 DCHECK(IsValid()); | 367 DCHECK(IsValid()); |
| 368 return false; | 368 return false; |
| 369 } | 369 } |
| 370 | 370 |
| 371 bool Process::SetProcessBackgrounded(bool value) { | 371 bool Process::SetProcessBackgrounded(bool value) { |
| 372 // Not implemented for POSIX systems other than Linux and Mac. With POSIX, if | 372 // Not implemented for POSIX systems other than Linux and Mac. With POSIX, if |
| 373 // we were to lower the process priority we wouldn't be able to raise it back | 373 // we were to lower the process priority we wouldn't be able to raise it back |
| 374 // to its initial priority. | 374 // to its initial priority. |
| 375 NOTIMPLEMENTED(); | 375 NOTIMPLEMENTED(); |
| 376 return false; | 376 return false; |
| 377 } | 377 } |
| 378 #endif // !defined(OS_LINUX) && !defined(OS_MACOSX) | 378 #endif // !defined(OS_LINUX) && !defined(OS_MACOSX) |
| 379 | 379 |
| 380 int Process::GetPriority() const { | 380 int Process::GetPriority() const { |
| 381 DCHECK(IsValid()); | 381 DCHECK(IsValid()); |
| 382 return getpriority(PRIO_PROCESS, process_); | 382 return getpriority(PRIO_PROCESS, process_); |
| 383 } | 383 } |
| 384 | 384 |
| 385 } // namespace base | 385 } // namespace base |
| OLD | NEW |