| 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 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 data_)); | 305 data_)); |
| 306 } | 306 } |
| 307 } | 307 } |
| 308 | 308 |
| 309 void BrowserChildProcessHostImpl::OnChannelError() { | 309 void BrowserChildProcessHostImpl::OnChannelError() { |
| 310 delegate_->OnChannelError(); | 310 delegate_->OnChannelError(); |
| 311 } | 311 } |
| 312 | 312 |
| 313 void BrowserChildProcessHostImpl::OnBadMessageReceived( | 313 void BrowserChildProcessHostImpl::OnBadMessageReceived( |
| 314 const IPC::Message& message) { | 314 const IPC::Message& message) { |
| 315 TerminateOnBadMessageReceived(message.type()); |
| 316 } |
| 317 |
| 318 void BrowserChildProcessHostImpl::TerminateOnBadMessageReceived(uint32_t type) { |
| 315 HistogramBadMessageTerminated(data_.process_type); | 319 HistogramBadMessageTerminated(data_.process_type); |
| 316 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 320 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 317 switches::kDisableKillAfterBadIPC)) { | 321 switches::kDisableKillAfterBadIPC)) { |
| 318 return; | 322 return; |
| 319 } | 323 } |
| 320 LOG(ERROR) << "Terminating child process for bad IPC message of type " | 324 LOG(ERROR) << "Terminating child process for bad IPC message of type " |
| 321 << message.type(); | 325 << type; |
| 322 | 326 |
| 323 // Create a memory dump. This will contain enough stack frames to work out | 327 // Create a memory dump. This will contain enough stack frames to work out |
| 324 // what the bad message was. | 328 // what the bad message was. |
| 325 base::debug::DumpWithoutCrashing(); | 329 base::debug::DumpWithoutCrashing(); |
| 326 | 330 |
| 327 child_process_->GetProcess().Terminate(RESULT_CODE_KILLED_BAD_MESSAGE, false); | 331 child_process_->GetProcess().Terminate(RESULT_CODE_KILLED_BAD_MESSAGE, false); |
| 328 } | 332 } |
| 329 | 333 |
| 330 bool BrowserChildProcessHostImpl::CanShutdown() { | 334 bool BrowserChildProcessHostImpl::CanShutdown() { |
| 331 return delegate_->CanShutdown(); | 335 return delegate_->CanShutdown(); |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 458 | 462 |
| 459 #if defined(OS_WIN) | 463 #if defined(OS_WIN) |
| 460 | 464 |
| 461 void BrowserChildProcessHostImpl::OnObjectSignaled(HANDLE object) { | 465 void BrowserChildProcessHostImpl::OnObjectSignaled(HANDLE object) { |
| 462 OnChildDisconnected(); | 466 OnChildDisconnected(); |
| 463 } | 467 } |
| 464 | 468 |
| 465 #endif | 469 #endif |
| 466 | 470 |
| 467 } // namespace content | 471 } // namespace content |
| OLD | NEW |