diff options
author | jamescook <jamescook@chromium.org> | 2015-03-20 11:01:18 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-03-20 18:02:04 +0000 |
commit | da2505817c8cac8331a0fcab1902e71f3c2b7daf (patch) | |
tree | 2f37dc19abca0f345ba4a6d92f852a7e90e9ef21 /extensions/browser/bad_message.cc | |
parent | e331ef6c7b1f7f335ceb33462bbf9450e4f5df20 (diff) | |
download | chromium_src-da2505817c8cac8331a0fcab1902e71f3c2b7daf.zip chromium_src-da2505817c8cac8331a0fcab1902e71f3c2b7daf.tar.gz chromium_src-da2505817c8cac8331a0fcab1902e71f3c2b7daf.tar.bz2 |
Add UMA histograms and logging for bad IPC message handling
Many different places in the Chrome codebase handle unexpected IPC data
by killing the renderer. This can result in hard-to-debug sad tab pages.
Some, but not all, of these locations log an error; others record UMA
user actions. This CL fixes most sites to both log and record metrics.
It also switches the metrics to be histograms instead of user actions
because we don't need the extra timestamp data from user actions and
most of these sorts of metrics live in histograms.
BUG=462687
TEST=unit_tests
Review URL: https://codereview.chromium.org/1009583004
Cr-Commit-Position: refs/heads/master@{#321598}
Diffstat (limited to 'extensions/browser/bad_message.cc')
-rw-r--r-- | extensions/browser/bad_message.cc | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/extensions/browser/bad_message.cc b/extensions/browser/bad_message.cc new file mode 100644 index 0000000..85ce5d6 --- /dev/null +++ b/extensions/browser/bad_message.cc @@ -0,0 +1,24 @@ +// Copyright 2015 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "extensions/browser/bad_message.h" + +#include "base/logging.h" +#include "base/metrics/histogram_macros.h" +#include "content/public/browser/render_process_host.h" + +namespace extensions { +namespace bad_message { + +void ReceivedBadMessage(content::RenderProcessHost* host, + BadMessageReason reason) { + LOG(ERROR) << "Terminating extension renderer for bad IPC message, reason " + << reason; + UMA_HISTOGRAM_ENUMERATION("Stability.BadMessageTerminated.Extensions", reason, + BAD_MESSAGE_MAX); + host->ShutdownForBadMessage(); +} + +} // namespace bad_message +} // namespace extensions |