| Index: net/disk_cache/stats_histogram.cc
|
| ===================================================================
|
| --- net/disk_cache/stats_histogram.cc (revision 76117)
|
| +++ net/disk_cache/stats_histogram.cc (working copy)
|
| @@ -32,12 +32,11 @@
|
| if (StatisticsRecorder::FindHistogram(name, &histogram)) {
|
| DCHECK(histogram.get() != NULL);
|
| } else {
|
| - histogram = new StatsHistogram(name, minimum, maximum, bucket_count);
|
| - scoped_refptr<Histogram> registered_histogram(NULL);
|
| - StatisticsRecorder::FindHistogram(name, ®istered_histogram);
|
| - if (registered_histogram.get() != NULL &&
|
| - registered_histogram.get() != histogram.get())
|
| - histogram = registered_histogram;
|
| + StatsHistogram* stats_histogram = new StatsHistogram(name, minimum, maximum,
|
| + bucket_count);
|
| + stats_histogram->InitializeBucketRange();
|
| + histogram = stats_histogram;
|
| + StatisticsRecorder::Register(&histogram);
|
| }
|
|
|
| DCHECK(HISTOGRAM == histogram->histogram_type());
|
| @@ -48,6 +47,9 @@
|
| Histogram* temp_histogram = histogram.get();
|
| StatsHistogram* temp_stats_histogram =
|
| static_cast<StatsHistogram*>(temp_histogram);
|
| + // Validate upcast by seeing that we're probably providing the checksum.
|
| + CHECK_EQ(temp_stats_histogram->StatsHistogram::CalculateRangeChecksum(),
|
| + temp_stats_histogram->CalculateRangeChecksum());
|
| scoped_refptr<StatsHistogram> return_histogram(temp_stats_histogram);
|
| return return_histogram;
|
| }
|
| @@ -91,5 +93,10 @@
|
| return NO_INCONSISTENCIES; // This class won't monitor inconsistencies.
|
| }
|
|
|
| +uint32 StatsHistogram::CalculateRangeChecksum() const {
|
| + // We don't calculate checksums, so at least establish a unique constant.
|
| + const uint32 kStatsHistogramChecksum = 0x0cecce;
|
| + return kStatsHistogramChecksum;
|
| +}
|
|
|
| } // namespace disk_cache
|
|
|