Index: net/disk_cache/stats.h |
=================================================================== |
--- net/disk_cache/stats.h (revision 199883) |
+++ net/disk_cache/stats.h (working copy) |
@@ -9,6 +9,7 @@ |
#include <vector> |
#include "base/basictypes.h" |
+#include "net/disk_cache/addr.h" |
#include "net/disk_cache/stats_histogram.h" |
namespace base { |
@@ -17,8 +18,6 @@ |
namespace disk_cache { |
-class BackendImpl; |
- |
typedef std::vector<std::pair<std::string, std::string> > StatsItems; |
// This class stores cache-specific usage information, for tunning purposes. |
@@ -48,15 +47,22 @@ |
LAST_REPORT, // Time of the last time we sent a report. |
LAST_REPORT_TIMER, // Timer count of the last time we sent a report. |
DOOM_RECENT, // The cache was partially cleared. |
- GAJS_EVICTED, // ga.js was evicted from the cache. |
+ UNUSED, // Was: ga.js was evicted from the cache. |
MAX_COUNTER |
}; |
Stats(); |
~Stats(); |
- bool Init(BackendImpl* backend, uint32* storage_addr); |
+ // Initializes this object with |data| from disk. |
+ bool Init(void* data, int num_bytes, Addr address); |
+ // Generates a size distribution histogram. |
+ void InitSizeHistogram(); |
+ |
+ // Returns the number of bytes needed to store the stats on disk. |
+ int StorageSize(); |
+ |
// Tracks changes to the stoage space used by an entry. |
void ModifyStorageStats(int32 old_size, int32 new_size); |
@@ -73,8 +79,9 @@ |
// Returns the lower bound of the space used by entries bigger than 512 KB. |
int GetLargeEntriesSize(); |
- // Saves the stats to disk. |
- void Store(); |
+ // Writes the stats into |data|, to be stored at the given cache address. |
+ // Returns the number of bytes copied. |
+ int SerializeStats(void* data, int num_bytes, Addr* address); |
// Support for StatsHistograms. Together, these methods allow StatsHistograms |
// to take a snapshot of the data_sizes_ as the histogram data. |
@@ -85,8 +92,7 @@ |
int GetStatsBucket(int32 size); |
int GetRatio(Counters hit, Counters miss) const; |
- BackendImpl* backend_; |
- uint32 storage_addr_; |
+ Addr storage_addr_; |
int data_sizes_[kDataSizesLength]; |
int64 counters_[MAX_COUNTER]; |
StatsHistogram* size_histogram_; |