| 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 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 408 bool ChildProcessLauncher::IsStarting() { | 408 bool ChildProcessLauncher::IsStarting() { |
| 409 return context_->starting_; | 409 return context_->starting_; |
| 410 } | 410 } |
| 411 | 411 |
| 412 base::ProcessHandle ChildProcessLauncher::GetHandle() { | 412 base::ProcessHandle ChildProcessLauncher::GetHandle() { |
| 413 DCHECK(!context_->starting_); | 413 DCHECK(!context_->starting_); |
| 414 return context_->process_.handle(); | 414 return context_->process_.handle(); |
| 415 } | 415 } |
| 416 | 416 |
| 417 base::TerminationStatus ChildProcessLauncher::GetChildTerminationStatus( | 417 base::TerminationStatus ChildProcessLauncher::GetChildTerminationStatus( |
| 418 bool known_dead, |
| 418 int* exit_code) { | 419 int* exit_code) { |
| 419 base::ProcessHandle handle = context_->process_.handle(); | 420 base::ProcessHandle handle = context_->process_.handle(); |
| 420 if (handle == base::kNullProcessHandle) { | 421 if (handle == base::kNullProcessHandle) { |
| 421 // Process is already gone, so return the cached termination status. | 422 // Process is already gone, so return the cached termination status. |
| 422 if (exit_code) | 423 if (exit_code) |
| 423 *exit_code = context_->exit_code_; | 424 *exit_code = context_->exit_code_; |
| 424 return context_->termination_status_; | 425 return context_->termination_status_; |
| 425 } | 426 } |
| 426 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) | 427 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) |
| 427 if (context_->zygote_) { | 428 if (context_->zygote_) { |
| 428 context_->termination_status_ = ZygoteHostImpl::GetInstance()-> | 429 context_->termination_status_ = ZygoteHostImpl::GetInstance()-> |
| 429 GetTerminationStatus(handle, &context_->exit_code_); | 430 GetTerminationStatus(handle, known_dead, &context_->exit_code_); |
| 430 } else | 431 } else |
| 431 #endif | 432 #endif |
| 432 { | 433 { |
| 433 context_->termination_status_ = | 434 context_->termination_status_ = |
| 434 base::GetTerminationStatus(handle, &context_->exit_code_); | 435 base::GetTerminationStatus(handle, &context_->exit_code_); |
| 435 } | 436 } |
| 436 | 437 |
| 437 if (exit_code) | 438 if (exit_code) |
| 438 *exit_code = context_->exit_code_; | 439 *exit_code = context_->exit_code_; |
| 439 | 440 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 457 GetHandle(), background)); | 458 GetHandle(), background)); |
| 458 } | 459 } |
| 459 | 460 |
| 460 void ChildProcessLauncher::SetTerminateChildOnShutdown( | 461 void ChildProcessLauncher::SetTerminateChildOnShutdown( |
| 461 bool terminate_on_shutdown) { | 462 bool terminate_on_shutdown) { |
| 462 if (context_) | 463 if (context_) |
| 463 context_->set_terminate_child_on_shutdown(terminate_on_shutdown); | 464 context_->set_terminate_child_on_shutdown(terminate_on_shutdown); |
| 464 } | 465 } |
| 465 | 466 |
| 466 } // namespace content | 467 } // namespace content |
| OLD | NEW |