Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(81)

Side by Side Diff: net/disk_cache/stats_histogram.cc

Issue 11342060: Histogram type support in HistogramBase and remove SetRangeDescription function (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove "using" from metrics.cc Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/extensions/api/metrics/metrics_apitest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/disk_cache/stats_histogram.h" 5 #include "net/disk_cache/stats_histogram.h"
6 6
7 #include "base/debug/leak_annotations.h" 7 #include "base/debug/leak_annotations.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/metrics/bucket_ranges.h" 9 #include "base/metrics/bucket_ranges.h"
10 #include "base/metrics/histogram_base.h" 10 #include "base/metrics/histogram_base.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 StatisticsRecorder::RegisterOrDeleteDuplicateRanges(ranges); 56 StatisticsRecorder::RegisterOrDeleteDuplicateRanges(ranges);
57 57
58 // To avoid racy destruction at shutdown, the following will be leaked. 58 // To avoid racy destruction at shutdown, the following will be leaked.
59 StatsHistogram* stats_histogram = 59 StatsHistogram* stats_histogram =
60 new StatsHistogram(name, minimum, maximum, bucket_count, 60 new StatsHistogram(name, minimum, maximum, bucket_count,
61 registered_ranges, stats); 61 registered_ranges, stats);
62 stats_histogram->SetFlags(kUmaTargetedHistogramFlag); 62 stats_histogram->SetFlags(kUmaTargetedHistogramFlag);
63 histogram = StatisticsRecorder::RegisterOrDeleteDuplicate(stats_histogram); 63 histogram = StatisticsRecorder::RegisterOrDeleteDuplicate(stats_histogram);
64 } 64 }
65 65
66 DCHECK(HISTOGRAM == histogram->histogram_type()); 66 DCHECK(base::HISTOGRAM == histogram->GetHistogramType());
67 DCHECK(histogram->HasConstructionArguments(minimum, maximum, bucket_count)); 67 DCHECK(histogram->HasConstructionArguments(minimum, maximum, bucket_count));
68 68
69 // We're preparing for an otherwise unsafe upcast by ensuring we have the 69 // We're preparing for an otherwise unsafe upcast by ensuring we have the
70 // proper class type. 70 // proper class type.
71 StatsHistogram* return_histogram = static_cast<StatsHistogram*>(histogram); 71 StatsHistogram* return_histogram = static_cast<StatsHistogram*>(histogram);
72 return return_histogram; 72 return return_histogram;
73 } 73 }
74 74
75 scoped_ptr<HistogramSamples> StatsHistogram::SnapshotSamples() const { 75 scoped_ptr<HistogramSamples> StatsHistogram::SnapshotSamples() const {
76 scoped_ptr<SampleVector> samples(new SampleVector(bucket_ranges())); 76 scoped_ptr<SampleVector> samples(new SampleVector(bucket_ranges()));
77 stats_->Snapshot(samples.get()); 77 stats_->Snapshot(samples.get());
78 78
79 // Only report UMA data once. 79 // Only report UMA data once.
80 StatsHistogram* mutable_me = const_cast<StatsHistogram*>(this); 80 StatsHistogram* mutable_me = const_cast<StatsHistogram*>(this);
81 mutable_me->ClearFlags(kUmaTargetedHistogramFlag); 81 mutable_me->ClearFlags(kUmaTargetedHistogramFlag);
82 82
83 return samples.PassAs<HistogramSamples>(); 83 return samples.PassAs<HistogramSamples>();
84 } 84 }
85 85
86 Histogram::Inconsistencies StatsHistogram::FindCorruption( 86 Histogram::Inconsistencies StatsHistogram::FindCorruption(
87 const HistogramSamples& samples) const { 87 const HistogramSamples& samples) const {
88 return NO_INCONSISTENCIES; // This class won't monitor inconsistencies. 88 return NO_INCONSISTENCIES; // This class won't monitor inconsistencies.
89 } 89 }
90 90
91 } // namespace disk_cache 91 } // namespace disk_cache
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/metrics/metrics_apitest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698