| 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/files/file_path.h" | 11 #include "base/files/file_path.h" |
| 11 #include "base/lazy_instance.h" | 12 #include "base/lazy_instance.h" |
| 12 #include "base/logging.h" | 13 #include "base/logging.h" |
| 13 #include "base/metrics/histogram.h" | 14 #include "base/metrics/histogram.h" |
| 14 #include "base/profiler/scoped_tracker.h" | 15 #include "base/profiler/scoped_tracker.h" |
| 15 #include "base/stl_util.h" | 16 #include "base/stl_util.h" |
| 16 #include "base/strings/string_util.h" | 17 #include "base/strings/string_util.h" |
| 17 #include "base/synchronization/waitable_event.h" | 18 #include "base/synchronization/waitable_event.h" |
| 18 #include "content/browser/histogram_message_filter.h" | 19 #include "content/browser/histogram_message_filter.h" |
| 19 #include "content/browser/loader/resource_message_filter.h" | 20 #include "content/browser/loader/resource_message_filter.h" |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 | 248 |
| 248 void BrowserChildProcessHostImpl::OnBadMessageReceived( | 249 void BrowserChildProcessHostImpl::OnBadMessageReceived( |
| 249 const IPC::Message& message) { | 250 const IPC::Message& message) { |
| 250 HistogramBadMessageTerminated(data_.process_type); | 251 HistogramBadMessageTerminated(data_.process_type); |
| 251 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 252 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 252 switches::kDisableKillAfterBadIPC)) { | 253 switches::kDisableKillAfterBadIPC)) { |
| 253 return; | 254 return; |
| 254 } | 255 } |
| 255 LOG(ERROR) << "Terminating child process for bad IPC message of type " | 256 LOG(ERROR) << "Terminating child process for bad IPC message of type " |
| 256 << message.type(); | 257 << message.type(); |
| 258 |
| 259 // Create a memory dump. This will contain enough stack frames to work out |
| 260 // what the bad message was. |
| 261 base::debug::DumpWithoutCrashing(); |
| 262 |
| 257 child_process_->GetProcess().Terminate(RESULT_CODE_KILLED_BAD_MESSAGE, false); | 263 child_process_->GetProcess().Terminate(RESULT_CODE_KILLED_BAD_MESSAGE, false); |
| 258 } | 264 } |
| 259 | 265 |
| 260 bool BrowserChildProcessHostImpl::CanShutdown() { | 266 bool BrowserChildProcessHostImpl::CanShutdown() { |
| 261 return delegate_->CanShutdown(); | 267 return delegate_->CanShutdown(); |
| 262 } | 268 } |
| 263 | 269 |
| 264 void BrowserChildProcessHostImpl::OnChildDisconnected() { | 270 void BrowserChildProcessHostImpl::OnChildDisconnected() { |
| 265 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 271 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 266 #if defined(OS_WIN) | 272 #if defined(OS_WIN) |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 | 348 |
| 343 #if defined(OS_WIN) | 349 #if defined(OS_WIN) |
| 344 | 350 |
| 345 void BrowserChildProcessHostImpl::OnObjectSignaled(HANDLE object) { | 351 void BrowserChildProcessHostImpl::OnObjectSignaled(HANDLE object) { |
| 346 OnChildDisconnected(); | 352 OnChildDisconnected(); |
| 347 } | 353 } |
| 348 | 354 |
| 349 #endif | 355 #endif |
| 350 | 356 |
| 351 } // namespace content | 357 } // namespace content |
| OLD | NEW |