OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/kill.h" | 5 #include "base/process/kill.h" |
6 | 6 |
7 #include <signal.h> | 7 #include <signal.h> |
8 #include <sys/types.h> | 8 #include <sys/types.h> |
9 #include <sys/wait.h> | 9 #include <sys/wait.h> |
10 #include <unistd.h> | 10 #include <unistd.h> |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 << ", ident=" << event.ident; | 347 << ", ident=" << event.ident; |
348 return false; | 348 return false; |
349 } | 349 } |
350 | 350 |
351 return true; | 351 return true; |
352 } | 352 } |
353 #endif // OS_MACOSX | 353 #endif // OS_MACOSX |
354 | 354 |
355 bool WaitForSingleProcess(ProcessHandle handle, base::TimeDelta wait) { | 355 bool WaitForSingleProcess(ProcessHandle handle, base::TimeDelta wait) { |
356 ProcessHandle parent_pid = GetParentProcessId(handle); | 356 ProcessHandle parent_pid = GetParentProcessId(handle); |
357 ProcessHandle our_pid = Process::Current().handle(); | 357 ProcessHandle our_pid = GetCurrentProcessHandle(); |
358 if (parent_pid != our_pid) { | 358 if (parent_pid != our_pid) { |
359 #if defined(OS_MACOSX) | 359 #if defined(OS_MACOSX) |
360 // On Mac we can wait on non child processes. | 360 // On Mac we can wait on non child processes. |
361 return WaitForSingleNonChildProcess(handle, wait); | 361 return WaitForSingleNonChildProcess(handle, wait); |
362 #else | 362 #else |
363 // Currently on Linux we can't handle non child processes. | 363 // Currently on Linux we can't handle non child processes. |
364 NOTIMPLEMENTED(); | 364 NOTIMPLEMENTED(); |
365 #endif // OS_MACOSX | 365 #endif // OS_MACOSX |
366 } | 366 } |
367 | 367 |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 if (IsChildDead(process)) | 473 if (IsChildDead(process)) |
474 return; | 474 return; |
475 | 475 |
476 BackgroundReaper* reaper = new BackgroundReaper(process, 0); | 476 BackgroundReaper* reaper = new BackgroundReaper(process, 0); |
477 PlatformThread::CreateNonJoinable(0, reaper); | 477 PlatformThread::CreateNonJoinable(0, reaper); |
478 } | 478 } |
479 | 479 |
480 #endif // !defined(OS_MACOSX) | 480 #endif // !defined(OS_MACOSX) |
481 | 481 |
482 } // namespace base | 482 } // namespace base |
OLD | NEW |