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

Unified Diff: net/disk_cache/stats.h

Issue 15772003: Disk Cache: Make Stats independent of the backend implementation. (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 side-by-side diff with in-line comments
Download patch
Index: net/disk_cache/stats.h
===================================================================
--- net/disk_cache/stats.h (revision 201602)
+++ 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.
@@ -55,8 +54,15 @@
Stats();
~Stats();
- bool Init(BackendImpl* backend, uint32* storage_addr);
+ // Initializes this object with the provided |data| comming from disk.
gavinp 2013/05/23 15:32:33 Spelling, but also I think the grammar is a bit aw
rvargas (doing something else) 2013/05/23 19:39:43 Done.
+ 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,8 @@
// 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.
+ bool 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 +91,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_;

Powered by Google App Engine
This is Rietveld 408576698