Chromium Code Reviews| Index: net/disk_cache/blockfile/stats.cc |
| diff --git a/net/disk_cache/blockfile/stats.cc b/net/disk_cache/blockfile/stats.cc |
| index e6b10b878569c04b733e39ecfe1d4f532b994890..b8cdb18d93d78d17026c9dce023ba096f74af56a 100644 |
| --- a/net/disk_cache/blockfile/stats.cc |
| +++ b/net/disk_cache/blockfile/stats.cc |
| @@ -107,8 +107,18 @@ bool Stats::Init(void* data, int num_bytes, Addr address) { |
| local_stats.size = sizeof(local_stats); |
| } else if (num_bytes >= static_cast<int>(sizeof(*stats))) { |
| stats = reinterpret_cast<OnDiskStats*>(data); |
| - if (!VerifyStats(stats)) |
| - return false; |
| + if (!VerifyStats(stats)) { |
| + memset(&local_stats, 0, sizeof(local_stats)); |
| + if (memcmp(stats, &local_stats, sizeof(local_stats))) { |
| + return false; |
| + } else { |
| + // The sorage is empty which means that SerializeStats() was never |
|
ramant (doing other things)
2015/03/05 01:09:35
nit: sorage -> storage?
rvargas (doing something else)
2015/03/05 02:23:50
Done.
|
| + // called on the last run. Just re-initialize everything. |
| + local_stats.signature = kDiskSignature; |
| + local_stats.size = sizeof(local_stats); |
| + stats = &local_stats; |
| + } |
| + } |
| } else { |
| return false; |
| } |