| 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 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 578 | 578 |
| 579 // static | 579 // static |
| 580 void BrowserChildProcessHostImpl::OnMojoError( | 580 void BrowserChildProcessHostImpl::OnMojoError( |
| 581 base::WeakPtr<BrowserChildProcessHostImpl> process, | 581 base::WeakPtr<BrowserChildProcessHostImpl> process, |
| 582 scoped_refptr<base::SingleThreadTaskRunner> task_runner, | 582 scoped_refptr<base::SingleThreadTaskRunner> task_runner, |
| 583 const std::string& error) { | 583 const std::string& error) { |
| 584 if (!task_runner->BelongsToCurrentThread()) { | 584 if (!task_runner->BelongsToCurrentThread()) { |
| 585 task_runner->PostTask( | 585 task_runner->PostTask( |
| 586 FROM_HERE, base::Bind(&BrowserChildProcessHostImpl::OnMojoError, | 586 FROM_HERE, base::Bind(&BrowserChildProcessHostImpl::OnMojoError, |
| 587 process, task_runner, error)); | 587 process, task_runner, error)); |
| 588 return; |
| 588 } | 589 } |
| 589 if (!process) | 590 if (!process) |
| 590 return; | 591 return; |
| 591 HistogramBadMessageTerminated(process->data_.process_type); | 592 HistogramBadMessageTerminated(process->data_.process_type); |
| 592 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 593 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 593 switches::kDisableKillAfterBadIPC)) { | 594 switches::kDisableKillAfterBadIPC)) { |
| 594 return; | 595 return; |
| 595 } | 596 } |
| 596 LOG(ERROR) << "Terminating child process for bad Mojo message: " << error; | 597 LOG(ERROR) << "Terminating child process for bad Mojo message: " << error; |
| 597 | 598 |
| 598 // Create a memory dump with the error message aliased. This will make it easy | 599 // Create a memory dump with the error message aliased. This will make it easy |
| 599 // to determine details about what interface call failed. | 600 // to determine details about what interface call failed. |
| 600 base::debug::Alias(&error); | 601 base::debug::Alias(&error); |
| 601 base::debug::DumpWithoutCrashing(); | 602 base::debug::DumpWithoutCrashing(); |
| 602 process->child_process_->GetProcess().Terminate( | 603 process->child_process_->GetProcess().Terminate( |
| 603 RESULT_CODE_KILLED_BAD_MESSAGE, false); | 604 RESULT_CODE_KILLED_BAD_MESSAGE, false); |
| 604 } | 605 } |
| 605 | 606 |
| 606 #if defined(OS_WIN) | 607 #if defined(OS_WIN) |
| 607 | 608 |
| 608 void BrowserChildProcessHostImpl::OnObjectSignaled(HANDLE object) { | 609 void BrowserChildProcessHostImpl::OnObjectSignaled(HANDLE object) { |
| 609 OnChildDisconnected(); | 610 OnChildDisconnected(); |
| 610 } | 611 } |
| 611 | 612 |
| 612 #endif | 613 #endif |
| 613 | 614 |
| 614 } // namespace content | 615 } // namespace content |
| OLD | NEW |