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

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

Issue 15956004: Disk cache: Avoid writing uninitialized data to disk. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 7 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
« no previous file with comments | « net/disk_cache/backend_impl.cc ('k') | net/disk_cache/stats.cc » ('j') | 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 #ifndef NET_DISK_CACHE_STATS_H_ 5 #ifndef NET_DISK_CACHE_STATS_H_
6 #define NET_DISK_CACHE_STATS_H_ 6 #define NET_DISK_CACHE_STATS_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 73
74 void GetItems(StatsItems* items); 74 void GetItems(StatsItems* items);
75 int GetHitRatio() const; 75 int GetHitRatio() const;
76 int GetResurrectRatio() const; 76 int GetResurrectRatio() const;
77 void ResetRatios(); 77 void ResetRatios();
78 78
79 // Returns the lower bound of the space used by entries bigger than 512 KB. 79 // Returns the lower bound of the space used by entries bigger than 512 KB.
80 int GetLargeEntriesSize(); 80 int GetLargeEntriesSize();
81 81
82 // Writes the stats into |data|, to be stored at the given cache address. 82 // Writes the stats into |data|, to be stored at the given cache address.
83 bool SerializeStats(void* data, int num_bytes, Addr* address); 83 // Returns the number of bytes copied.
84 int SerializeStats(void* data, int num_bytes, Addr* address);
84 85
85 // Support for StatsHistograms. Together, these methods allow StatsHistograms 86 // Support for StatsHistograms. Together, these methods allow StatsHistograms
86 // to take a snapshot of the data_sizes_ as the histogram data. 87 // to take a snapshot of the data_sizes_ as the histogram data.
87 int GetBucketRange(size_t i) const; 88 int GetBucketRange(size_t i) const;
88 void Snapshot(base::HistogramSamples* samples) const; 89 void Snapshot(base::HistogramSamples* samples) const;
89 90
90 private: 91 private:
91 int GetStatsBucket(int32 size); 92 int GetStatsBucket(int32 size);
92 int GetRatio(Counters hit, Counters miss) const; 93 int GetRatio(Counters hit, Counters miss) const;
93 94
94 Addr storage_addr_; 95 Addr storage_addr_;
95 int data_sizes_[kDataSizesLength]; 96 int data_sizes_[kDataSizesLength];
96 int64 counters_[MAX_COUNTER]; 97 int64 counters_[MAX_COUNTER];
97 StatsHistogram* size_histogram_; 98 StatsHistogram* size_histogram_;
98 99
99 DISALLOW_COPY_AND_ASSIGN(Stats); 100 DISALLOW_COPY_AND_ASSIGN(Stats);
100 }; 101 };
101 102
102 } // namespace disk_cache 103 } // namespace disk_cache
103 104
104 #endif // NET_DISK_CACHE_STATS_H_ 105 #endif // NET_DISK_CACHE_STATS_H_
OLDNEW
« no previous file with comments | « net/disk_cache/backend_impl.cc ('k') | net/disk_cache/stats.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698