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 "content/browser/child_process_launcher.h" | 5 #include "content/browser/child_process_launcher.h" |
6 | 6 |
7 #include <utility> // For std::pair. | 7 #include <utility> // For std::pair. |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
462 if (handle == base::kNullProcessHandle) { | 462 if (handle == base::kNullProcessHandle) { |
463 // Process is already gone, so return the cached termination status. | 463 // Process is already gone, so return the cached termination status. |
464 if (exit_code) | 464 if (exit_code) |
465 *exit_code = context_->exit_code_; | 465 *exit_code = context_->exit_code_; |
466 return context_->termination_status_; | 466 return context_->termination_status_; |
467 } | 467 } |
468 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) | 468 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) |
469 if (context_->zygote_) { | 469 if (context_->zygote_) { |
470 context_->termination_status_ = ZygoteHostImpl::GetInstance()-> | 470 context_->termination_status_ = ZygoteHostImpl::GetInstance()-> |
471 GetTerminationStatus(handle, known_dead, &context_->exit_code_); | 471 GetTerminationStatus(handle, known_dead, &context_->exit_code_); |
472 } else | 472 } else { |
473 #elif defined(OS_MACOSX) | 473 #elif defined(OS_MACOSX) |
474 if (known_dead) { | 474 if (known_dead) { |
475 context_->termination_status_ = | 475 context_->termination_status_ = |
476 base::GetKnownDeadTerminationStatus(handle, &context_->exit_code_); | 476 base::GetKnownDeadTerminationStatus(handle, &context_->exit_code_); |
477 } else | 477 } else { |
| 478 #elif defined(OS_ANDROID) |
| 479 if (IsChildProcessOomProtected(handle)) { |
| 480 context_->termination_status_ = base::TERMINATION_STATUS_OOM_PROTECTED; |
| 481 } else { |
| 482 #else |
| 483 { |
478 #endif | 484 #endif |
479 { | |
480 context_->termination_status_ = | 485 context_->termination_status_ = |
481 base::GetTerminationStatus(handle, &context_->exit_code_); | 486 base::GetTerminationStatus(handle, &context_->exit_code_); |
482 } | 487 } |
483 | 488 |
484 if (exit_code) | 489 if (exit_code) |
485 *exit_code = context_->exit_code_; | 490 *exit_code = context_->exit_code_; |
486 | 491 |
487 // POSIX: If the process crashed, then the kernel closed the socket | 492 // POSIX: If the process crashed, then the kernel closed the socket |
488 // for it and so the child has already died by the time we get | 493 // for it and so the child has already died by the time we get |
489 // here. Since GetTerminationStatus called waitpid with WNOHANG, | 494 // here. Since GetTerminationStatus called waitpid with WNOHANG, |
(...skipping 14 matching lines...) Expand all Loading... |
504 GetHandle(), background)); | 509 GetHandle(), background)); |
505 } | 510 } |
506 | 511 |
507 void ChildProcessLauncher::SetTerminateChildOnShutdown( | 512 void ChildProcessLauncher::SetTerminateChildOnShutdown( |
508 bool terminate_on_shutdown) { | 513 bool terminate_on_shutdown) { |
509 if (context_.get()) | 514 if (context_.get()) |
510 context_->set_terminate_child_on_shutdown(terminate_on_shutdown); | 515 context_->set_terminate_child_on_shutdown(terminate_on_shutdown); |
511 } | 516 } |
512 | 517 |
513 } // namespace content | 518 } // namespace content |
OLD | NEW |