Disk cache: Re-initialize stats counters if they are zero on-disk.
commit4f2eab7cd613d87c79a192bfc5183f79483d95bf
authorrvargas <rvargas@chromium.org>
Thu, 5 Mar 2015 03:35:04 +0000 (4 19:35 -0800)
committerCommit bot <commit-bot@chromium.org>
Thu, 5 Mar 2015 03:35:52 +0000 (5 03:35 +0000)
treec5168a97a3becc6bc3f1d6d88ddaffa7832486f0
parentea82a5686c5810a40d610ae6439e29d994fe9f35
Disk cache: Re-initialize stats counters if they are zero on-disk.

Stats are saved to disk every five minutes. If a client is initializing
the cache, and it crashes before saving the stats for the first time,
the next run will see an empty stats storage, and will discard the cache
because it may indicate that the storage address was invalid.

Now, we check the contents to see if the storage was empty and re-initialize
things as needed.

BUG=none
TEST=net_unittests

Review URL: https://codereview.chromium.org/980003002

Cr-Commit-Position: refs/heads/master@{#319204}
net/disk_cache/blockfile/stats.cc
net/disk_cache/blockfile/stats.h
net/disk_cache/blockfile/stats_unittest.cc [new file with mode: 0644]
net/net.gypi