diff options
Diffstat (limited to 'net/disk_cache/stats.cc')
-rw-r--r-- | net/disk_cache/stats.cc | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/net/disk_cache/stats.cc b/net/disk_cache/stats.cc index 6047c5c..46c41a0 100644 --- a/net/disk_cache/stats.cc +++ b/net/disk_cache/stats.cc @@ -135,17 +135,7 @@ bool Stats::Init(BackendImpl* backend, uint32* storage_addr) { } Stats::~Stats() { - if (!backend_) - return; - - OnDiskStats stats; - stats.signature = kDiskSignature; - stats.size = sizeof(stats); - memcpy(stats.data_sizes, data_sizes_, sizeof(data_sizes_)); - memcpy(stats.counters, counters_, sizeof(counters_)); - - Addr address(storage_addr_); - StoreStats(backend_, address, &stats); + Store(); } // The array will be filled this way: @@ -267,4 +257,18 @@ void Stats::GetItems(StatsItems* items) { } } +void Stats::Store() { + if (!backend_) + return; + + OnDiskStats stats; + stats.signature = kDiskSignature; + stats.size = sizeof(stats); + memcpy(stats.data_sizes, data_sizes_, sizeof(data_sizes_)); + memcpy(stats.counters, counters_, sizeof(counters_)); + + Addr address(storage_addr_); + StoreStats(backend_, address, &stats); +} + } // namespace disk_cache |