| Index: net/disk_cache/addr.cc
|
| ===================================================================
|
| --- net/disk_cache/addr.cc (revision 199883)
|
| +++ net/disk_cache/addr.cc (working copy)
|
| @@ -26,11 +26,23 @@
|
| return true;
|
| }
|
|
|
| +Addr Addr::AsExternal() const {
|
| + DCHECK(file_type() == BLOCK_FILES);
|
| + CacheAddr new_value = value() & ~kFileTypeMask;
|
| + return Addr(new_value);
|
| +}
|
| +
|
| +Addr Addr::AsBlockFile() const {
|
| + DCHECK(is_separate_file());
|
| + CacheAddr new_value = value() + (BLOCK_FILES << kFileTypeOffset);
|
| + return Addr(new_value);
|
| +}
|
| +
|
| bool Addr::SanityCheck() const {
|
| if (!is_initialized())
|
| return !value_;
|
|
|
| - if (((value_ & kFileTypeMask) >> kFileTypeOffset) > 4)
|
| + if (((value_ & kFileTypeMask) >> kFileTypeOffset) > 5)
|
| return false;
|
|
|
| if (is_separate_file())
|
| @@ -40,7 +52,7 @@
|
| return !(value_ & kReservedBitsMask);
|
| }
|
|
|
| -bool Addr::SanityCheckForEntry() const {
|
| +bool Addr::SanityCheckForEntryV2() const {
|
| if (!SanityCheck() || !is_initialized())
|
| return false;
|
|
|
| @@ -50,6 +62,23 @@
|
| return true;
|
| }
|
|
|
| +bool Addr::SanityCheckForEntryV3() const {
|
| + if (!is_initialized())
|
| + return false;
|
| +
|
| + const uint32 kReservedBitsMask = 0x0c000000;
|
| + if (value_ & kReservedBitsMask)
|
| + return false;
|
| +
|
| + if (file_type() != BLOCK_ENTRIES && file_type() != BLOCK_EVICTED)
|
| + return false;
|
| +
|
| + if (num_blocks() != 1)
|
| + return false;
|
| +
|
| + return true;
|
| +}
|
| +
|
| bool Addr::SanityCheckForRankings() const {
|
| if (!SanityCheck() || !is_initialized())
|
| return false;
|
|
|