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 // If content is hosted within a process that has set a dump without crashing | |
jam
2015/04/06 16:00:04
I don't understand what this comment means? i.e. t
jam
2015/04/06 21:26:06
yeah, that would be clearer. or also take out the
| |
260 // function, then create a memory dump. This will contain enough stack frames | |
261 // to work out what the bad message was. | |
262 base::debug::DumpWithoutCrashing(); | |
263 | |
257 child_process_->GetProcess().Terminate(RESULT_CODE_KILLED_BAD_MESSAGE, false); | 264 child_process_->GetProcess().Terminate(RESULT_CODE_KILLED_BAD_MESSAGE, false); |
258 } | 265 } |
259 | 266 |
260 bool BrowserChildProcessHostImpl::CanShutdown() { | 267 bool BrowserChildProcessHostImpl::CanShutdown() { |
261 return delegate_->CanShutdown(); | 268 return delegate_->CanShutdown(); |
262 } | 269 } |
263 | 270 |
264 void BrowserChildProcessHostImpl::OnChildDisconnected() { | 271 void BrowserChildProcessHostImpl::OnChildDisconnected() { |
265 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 272 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
266 #if defined(OS_WIN) | 273 #if defined(OS_WIN) |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
342 | 349 |
343 #if defined(OS_WIN) | 350 #if defined(OS_WIN) |
344 | 351 |
345 void BrowserChildProcessHostImpl::OnObjectSignaled(HANDLE object) { | 352 void BrowserChildProcessHostImpl::OnObjectSignaled(HANDLE object) { |
346 OnChildDisconnected(); | 353 OnChildDisconnected(); |
347 } | 354 } |
348 | 355 |
349 #endif | 356 #endif |
350 | 357 |
351 } // namespace content | 358 } // namespace content |
OLD | NEW |