| 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/browser_child_process_host_impl.h" | 5 #include "content/browser/browser_child_process_host_impl.h" |
| 6 | 6 |
| 7 #include "base/base_switches.h" | 7 #include "base/base_switches.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/debug/dump_without_crashing.h" | 10 #include "base/debug/dump_without_crashing.h" |
| (...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 PROCESS_TYPE_MAX); | 388 PROCESS_TYPE_MAX); |
| 389 break; | 389 break; |
| 390 } | 390 } |
| 391 #if defined(OS_ANDROID) | 391 #if defined(OS_ANDROID) |
| 392 case base::TERMINATION_STATUS_OOM_PROTECTED: | 392 case base::TERMINATION_STATUS_OOM_PROTECTED: |
| 393 #endif | 393 #endif |
| 394 #if defined(OS_CHROMEOS) | 394 #if defined(OS_CHROMEOS) |
| 395 case base::TERMINATION_STATUS_PROCESS_WAS_KILLED_BY_OOM: | 395 case base::TERMINATION_STATUS_PROCESS_WAS_KILLED_BY_OOM: |
| 396 #endif | 396 #endif |
| 397 case base::TERMINATION_STATUS_PROCESS_WAS_KILLED: { | 397 case base::TERMINATION_STATUS_PROCESS_WAS_KILLED: { |
| 398 // If the IPC channel was disconnected after a shutdown request, we |
| 399 // expect the process to be dead. However, if the IPC channel uses |
| 400 // ChannelMojo, it is not true that the process is dead when the |
| 401 // disconnection event comes in. This is because Mojo does an orderly |
| 402 // shutdown in the child process and so the child may not be dead by the |
| 403 // time we get here. If the child isn't dead, the call to |
| 404 // GetTerminationStatus() above may cause the child to be killed because |
| 405 // GetTerminationStatus(known_dead=true) SIGKILLs the process before |
| 406 // waiting for it. |
| 407 if (child_process_host_->IsShuttingDown()) |
| 408 break; |
| 398 delegate_->OnProcessCrashed(exit_code); | 409 delegate_->OnProcessCrashed(exit_code); |
| 399 BrowserThread::PostTask( | 410 BrowserThread::PostTask( |
| 400 BrowserThread::UI, FROM_HERE, | 411 BrowserThread::UI, FROM_HERE, |
| 401 base::Bind(&NotifyProcessKilled, data_, exit_code)); | 412 base::Bind(&NotifyProcessKilled, data_, exit_code)); |
| 402 // Report that this child process was killed. | 413 // Report that this child process was killed. |
| 403 UMA_HISTOGRAM_ENUMERATION("ChildProcess.Killed2", | 414 UMA_HISTOGRAM_ENUMERATION("ChildProcess.Killed2", |
| 404 data_.process_type, | 415 data_.process_type, |
| 405 PROCESS_TYPE_MAX); | 416 PROCESS_TYPE_MAX); |
| 406 break; | 417 break; |
| 407 } | 418 } |
| 408 case base::TERMINATION_STATUS_STILL_RUNNING: { | 419 case base::TERMINATION_STATUS_STILL_RUNNING: { |
| 409 UMA_HISTOGRAM_ENUMERATION("ChildProcess.DisconnectedAlive2", | 420 UMA_HISTOGRAM_ENUMERATION("ChildProcess.DisconnectedAlive2", |
| 410 data_.process_type, | 421 data_.process_type, |
| 411 PROCESS_TYPE_MAX); | 422 PROCESS_TYPE_MAX); |
| 412 } | 423 } |
| 413 default: | 424 default: |
| 414 break; | 425 break; |
| 415 } | 426 } |
| 416 UMA_HISTOGRAM_ENUMERATION("ChildProcess.Disconnected2", | 427 UMA_HISTOGRAM_ENUMERATION("ChildProcess.Disconnected2", |
| 417 data_.process_type, | 428 data_.process_type, |
| 418 PROCESS_TYPE_MAX); | 429 PROCESS_TYPE_MAX); |
| 419 #if defined(OS_CHROMEOS) | 430 #if defined(OS_CHROMEOS) |
| 420 if (status == base::TERMINATION_STATUS_PROCESS_WAS_KILLED_BY_OOM) { | 431 if (status == base::TERMINATION_STATUS_PROCESS_WAS_KILLED_BY_OOM && |
| 432 !child_process_host_->IsShuttingDown()) { |
| 421 UMA_HISTOGRAM_ENUMERATION("ChildProcess.Killed2.OOM", | 433 UMA_HISTOGRAM_ENUMERATION("ChildProcess.Killed2.OOM", |
| 422 data_.process_type, | 434 data_.process_type, |
| 423 PROCESS_TYPE_MAX); | 435 PROCESS_TYPE_MAX); |
| 424 } | 436 } |
| 425 #endif | 437 #endif |
| 426 } | 438 } |
| 427 delete delegate_; // Will delete us | 439 delete delegate_; // Will delete us |
| 428 } | 440 } |
| 429 | 441 |
| 430 bool BrowserChildProcessHostImpl::Send(IPC::Message* message) { | 442 bool BrowserChildProcessHostImpl::Send(IPC::Message* message) { |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 471 | 483 |
| 472 #if defined(OS_WIN) | 484 #if defined(OS_WIN) |
| 473 | 485 |
| 474 void BrowserChildProcessHostImpl::OnObjectSignaled(HANDLE object) { | 486 void BrowserChildProcessHostImpl::OnObjectSignaled(HANDLE object) { |
| 475 OnChildDisconnected(); | 487 OnChildDisconnected(); |
| 476 } | 488 } |
| 477 | 489 |
| 478 #endif | 490 #endif |
| 479 | 491 |
| 480 } // namespace content | 492 } // namespace content |
| OLD | NEW |