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

Unified Diff: net/disk_cache/stats.h

Issue 15203004: Disk cache: Reference CL for the implementation of file format version 3. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: IndexTable review Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/disk_cache/sparse_control.cc ('k') | net/disk_cache/stats.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_;
« no previous file with comments | « net/disk_cache/sparse_control.cc ('k') | net/disk_cache/stats.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698