From 0ad73e927abaf87fe94ab78b048ef41c84e34992 Mon Sep 17 00:00:00 2001 From: "rtenneti@google.com" Date: Fri, 10 Aug 2012 01:43:23 +0000 Subject: Disable getting histogram data from child processes other than the renderer processes. Store the histogram name in the local variable for debugging purposes when we crash. R=jar TBR=jam BUG=140688 TEST=base (histogram unit tests) and unit_tests. Review URL: https://chromiumcodereview.appspot.com/10831247 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@150969 0039d316-1c4b-4281-b951-d872f2087c98 --- base/metrics/histogram_snapshot_manager.cc | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'base') diff --git a/base/metrics/histogram_snapshot_manager.cc b/base/metrics/histogram_snapshot_manager.cc index 2812c16..a3c9708 100644 --- a/base/metrics/histogram_snapshot_manager.cc +++ b/base/metrics/histogram_snapshot_manager.cc @@ -4,7 +4,10 @@ #include "base/metrics/histogram_snapshot_manager.h" +#include "base/compiler_specific.h" +#include "base/debug/alias.h" #include "base/metrics/statistics_recorder.h" +#include "base/string_util.h" using base::Histogram; using base::StatisticsRecorder; @@ -44,6 +47,12 @@ void HistogramSnapshotManager::PrepareDelta(const Histogram& histogram) { int corruption = histogram.FindCorruption(snapshot); + char histogram_name_buf[128]; + base::strlcpy(histogram_name_buf, + histogram_name.c_str(), + arraysize(histogram_name_buf)); + base::debug::Alias(histogram_name_buf); + // Crash if we detect that our histograms have been overwritten. This may be // a fair distance from the memory smasher, but we hope to correlate these // crashes with other events, such as plugins, or usage patterns, etc. -- cgit v1.1