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

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

Issue 10834011: Refactor of Histogram related code (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 months 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #ifndef NET_DISK_CACHE_STATS_HISTOGRAM_H_ 5 #ifndef NET_DISK_CACHE_STATS_HISTOGRAM_H_
6 #define NET_DISK_CACHE_STATS_HISTOGRAM_H_ 6 #define NET_DISK_CACHE_STATS_HISTOGRAM_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 11 matching lines...) Expand all
22 // 22 //
23 class StatsHistogram : public base::Histogram { 23 class StatsHistogram : public base::Histogram {
24 public: 24 public:
25 class StatsSamples : public SampleSet { 25 class StatsSamples : public SampleSet {
26 public: 26 public:
27 Counts* GetCounts() { 27 Counts* GetCounts() {
28 return &counts_; 28 return &counts_;
29 } 29 }
30 }; 30 };
31 31
32 StatsHistogram(const std::string& name, Sample minimum, 32 StatsHistogram(const std::string& name,
33 Sample maximum, size_t bucket_count) 33 Sample minimum,
34 : Histogram(name, minimum, maximum, bucket_count), init_(false) {} 34 Sample maximum,
35 size_t bucket_count)
36 : Histogram(name, minimum, maximum, bucket_count, NULL), init_(false) {}
35 virtual ~StatsHistogram(); 37 virtual ~StatsHistogram();
36 38
37 static StatsHistogram* FactoryGet(const std::string& name); 39 static StatsHistogram* FactoryGet(const std::string& name);
38 40
39 // We'll be reporting data from the given set of cache stats. 41 // We'll be reporting data from the given set of cache stats.
40 bool Init(const Stats* stats); 42 bool Init(const Stats* stats);
41 43
42 virtual Sample ranges(size_t i) const OVERRIDE; 44 virtual Sample ranges(size_t i) const OVERRIDE;
43 virtual size_t bucket_count() const OVERRIDE; 45 virtual size_t bucket_count() const OVERRIDE;
44 virtual void SnapshotSample(SampleSet* sample) const OVERRIDE; 46 virtual void SnapshotSample(SampleSet* sample) const OVERRIDE;
45 virtual Inconsistencies FindCorruption( 47 virtual Inconsistencies FindCorruption(
46 const SampleSet& snapshot) const OVERRIDE; 48 const SampleSet& snapshot) const OVERRIDE;
47 virtual uint32 CalculateRangeChecksum() const OVERRIDE;
48 49
49 private: 50 private:
50 bool init_; 51 bool init_;
51 static const Stats* stats_; 52 static const Stats* stats_;
52 DISALLOW_COPY_AND_ASSIGN(StatsHistogram); 53 DISALLOW_COPY_AND_ASSIGN(StatsHistogram);
53 }; 54 };
54 55
55 } // namespace disk_cache 56 } // namespace disk_cache
56 57
57 #endif // NET_DISK_CACHE_STATS_HISTOGRAM_H_ 58 #endif // NET_DISK_CACHE_STATS_HISTOGRAM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698