diff options
author | jar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-03 23:36:24 +0000 |
---|---|---|
committer | jar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-03 23:36:24 +0000 |
commit | 93a41d7ecc35fe54ed7182c1900de1e1461caea3 (patch) | |
tree | bbe216af5c78d1af1edd1c8bab62914c0ce3f117 /chrome/renderer | |
parent | 11e1866cf5c3aa00f5becd16c6306df83022f701 (diff) | |
download | chromium_src-93a41d7ecc35fe54ed7182c1900de1e1461caea3.zip chromium_src-93a41d7ecc35fe54ed7182c1900de1e1461caea3.tar.gz chromium_src-93a41d7ecc35fe54ed7182c1900de1e1461caea3.tar.bz2 |
Allow histograms in cache stats.cc to bypass corruption checks
This is a relanding of http://codereview.chromium.org/4174002
The change in this CL is that I've made the function
to look for errors virtual, and over-rode it in StatsHistograms.
The current override doesn't actually check for inconsistencies,
so that the UMA checks (and renderer-to-histogram checks) won't
complain and refuse to transport the histograms.
BUG=61281
r=rvargas
Review URL: http://codereview.chromium.org/4364001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@64990 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer')
-rw-r--r-- | chrome/renderer/renderer_histogram_snapshots.cc | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/chrome/renderer/renderer_histogram_snapshots.cc b/chrome/renderer/renderer_histogram_snapshots.cc index ae9ee1d..6124e04 100644 --- a/chrome/renderer/renderer_histogram_snapshots.cc +++ b/chrome/renderer/renderer_histogram_snapshots.cc @@ -52,17 +52,33 @@ void RendererHistogramSnapshots::UploadAllHistrograms(int sequence_number) { sequence_number, pickled_histograms)); } -// Extract snapshot data and then send it off the the Browser process -// to save it. +// Extract snapshot data, remember what we've seen so far, and then send off the +// delta to the browser. void RendererHistogramSnapshots::UploadHistrogram( const Histogram& histogram, HistogramPickledList* pickled_histograms) { - // Get up-to-date snapshot of sample stats. Histogram::SampleSet snapshot; histogram.SnapshotSample(&snapshot); const std::string& histogram_name = histogram.histogram_name(); + int corruption = histogram.FindCorruption(snapshot); + if (corruption) { + NOTREACHED(); + // Don't send corrupt data to the browser. + UMA_HISTOGRAM_ENUMERATION("Histogram.InconsistenciesRenderer", + corruption, Histogram::NEVER_EXCEEDED_VALUE); + typedef std::map<std::string, int> ProblemMap; + static ProblemMap* inconsistencies = new ProblemMap; + int old_corruption = (*inconsistencies)[histogram_name]; + if (old_corruption == (corruption | old_corruption)) + return; // We've already seen this corruption for this histogram. + (*inconsistencies)[histogram_name] |= corruption; + UMA_HISTOGRAM_ENUMERATION("Histogram.InconsistenciesRendererUnique", + corruption, Histogram::NEVER_EXCEEDED_VALUE); + return; + } + // Find the already sent stats, or create an empty set. LoggedSampleMap::iterator it = logged_samples_.find(histogram_name); Histogram::SampleSet* already_logged; @@ -89,7 +105,6 @@ void RendererHistogramSnapshots::UploadHistogramDelta( const Histogram& histogram, const Histogram::SampleSet& snapshot, HistogramPickledList* pickled_histograms) { - DCHECK(0 != snapshot.TotalCount()); snapshot.CheckSize(histogram); |