summaryrefslogtreecommitdiffstats
path: root/net/disk_cache/stats_histogram.h
diff options
context:
space:
mode:
authorjar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-28 19:30:05 +0000
committerjar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-28 19:30:05 +0000
commitb475f4e83d97a30434241a843e1fc67ac4b9bbf6 (patch)
treed76024cd376e34004de2ae15e1dc848941cb0d17 /net/disk_cache/stats_histogram.h
parent518ab06be60c5719087b880aa646f519dc745150 (diff)
downloadchromium_src-b475f4e83d97a30434241a843e1fc67ac4b9bbf6.zip
chromium_src-b475f4e83d97a30434241a843e1fc67ac4b9bbf6.tar.gz
chromium_src-b475f4e83d97a30434241a843e1fc67ac4b9bbf6.tar.bz2
Crash when we notice a corruption of the histogram range-vector
The range vector is calculated once when a histogram is constructed, and should never change over the lifetime of the histogram. When it does change, it means that memory is being overwritten. We now crash (via CHECK) when there is any detected corruption of the range vector. This CL uses a more robust check-sum algorithm to detect corruption of the vector. The previous algorithm just did a sum, and was too easilly tricked by small (offsetting) changes in several ranges. Hopefully, this CRC-32 implementation will not be so easilly fooled. I had to refactor the class to ensure that each histogram was completely constructed before I registered it. The old code could sometimes register a base class (tradtional Histogram, with exponential bucket spread) and then run the derived constructor (such as when creating a LinearHistogram, with a second construction of the ranges and checksum). I now carefully avoid generating the checksum until fully constructing the instance, and then I run InitializeBuckets only once on the instance before registering it. bug=73939 r=mbelshe Review URL: http://codereview.chromium.org/6577013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@76239 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/disk_cache/stats_histogram.h')
-rw-r--r--net/disk_cache/stats_histogram.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/net/disk_cache/stats_histogram.h b/net/disk_cache/stats_histogram.h
index 499784c..249327c 100644
--- a/net/disk_cache/stats_histogram.h
+++ b/net/disk_cache/stats_histogram.h
@@ -45,6 +45,7 @@ class StatsHistogram : public base::Histogram {
virtual size_t bucket_count() const;
virtual void SnapshotSample(SampleSet* sample) const;
virtual Inconsistencies FindCorruption(const SampleSet& snapshot) const;
+ virtual uint32 CalculateRangeChecksum() const;
private:
bool init_;