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 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 data_)); | 366 data_)); |
367 } | 367 } |
368 } | 368 } |
369 | 369 |
370 void BrowserChildProcessHostImpl::OnChannelError() { | 370 void BrowserChildProcessHostImpl::OnChannelError() { |
371 delegate_->OnChannelError(); | 371 delegate_->OnChannelError(); |
372 } | 372 } |
373 | 373 |
374 void BrowserChildProcessHostImpl::OnBadMessageReceived( | 374 void BrowserChildProcessHostImpl::OnBadMessageReceived( |
375 const IPC::Message& message) { | 375 const IPC::Message& message) { |
376 TerminateOnBadMessageReceived(message.type()); | 376 std::string log_message = |
| 377 base::StringPrintf("Bad message received of type: %u", message.type()); |
| 378 TerminateOnBadMessageReceived(log_message); |
377 } | 379 } |
378 | 380 |
379 void BrowserChildProcessHostImpl::TerminateOnBadMessageReceived(uint32_t type) { | 381 void BrowserChildProcessHostImpl::TerminateOnBadMessageReceived( |
| 382 const std::string& error) { |
380 HistogramBadMessageTerminated(data_.process_type); | 383 HistogramBadMessageTerminated(data_.process_type); |
381 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 384 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
382 switches::kDisableKillAfterBadIPC)) { | 385 switches::kDisableKillAfterBadIPC)) { |
383 return; | 386 return; |
384 } | 387 } |
385 LOG(ERROR) << "Terminating child process for bad IPC message of type " | 388 LOG(ERROR) << "Terminating child process for bad IPC message: " << error; |
386 << type; | |
387 | |
388 // Create a memory dump. This will contain enough stack frames to work out | 389 // Create a memory dump. This will contain enough stack frames to work out |
389 // what the bad message was. | 390 // what the bad message was. |
390 base::debug::DumpWithoutCrashing(); | 391 base::debug::DumpWithoutCrashing(); |
391 | 392 |
392 child_process_->GetProcess().Terminate(RESULT_CODE_KILLED_BAD_MESSAGE, false); | 393 child_process_->GetProcess().Terminate(RESULT_CODE_KILLED_BAD_MESSAGE, false); |
393 } | 394 } |
394 | 395 |
395 bool BrowserChildProcessHostImpl::CanShutdown() { | 396 bool BrowserChildProcessHostImpl::CanShutdown() { |
396 return delegate_->CanShutdown(); | 397 return delegate_->CanShutdown(); |
397 } | 398 } |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
600 | 601 |
601 #if defined(OS_WIN) | 602 #if defined(OS_WIN) |
602 | 603 |
603 void BrowserChildProcessHostImpl::OnObjectSignaled(HANDLE object) { | 604 void BrowserChildProcessHostImpl::OnObjectSignaled(HANDLE object) { |
604 OnChildDisconnected(); | 605 OnChildDisconnected(); |
605 } | 606 } |
606 | 607 |
607 #endif | 608 #endif |
608 | 609 |
609 } // namespace content | 610 } // namespace content |
OLD | NEW |