Index: net/disk_cache/addr.h |
=================================================================== |
--- net/disk_cache/addr.h (revision 232523) |
+++ net/disk_cache/addr.h (working copy) |
@@ -108,6 +108,11 @@ |
return value_ != other.value_; |
} |
+ // Conversions between the address of an external file and the address of the |
+ // control block of that external file. |
+ Addr AsExternal() const; |
+ Addr AsBlockFile() const; |
+ |
static Addr FromEntryAddress(uint32 value) { |
return Addr(kInitializedMask + (BLOCK_ENTRIES << kFileTypeOffset) + value); |
} |
@@ -116,6 +121,11 @@ |
return Addr(kInitializedMask + (BLOCK_EVICTED << kFileTypeOffset) + value); |
} |
+ // Returns the part of the address that could be stored by the index. |
+ uint32 ToIndexEntryAddress() const { |
+ return value_ & (kFileSelectorMask | kStartBlockMask); |
+ } |
+ |
static int BlockSizeForFileType(FileType file_type) { |
switch (file_type) { |
case RANKINGS: |
@@ -165,6 +175,8 @@ |
return value_ & kReservedBitsMask; |
} |
+ void SetFileType(FileType type); |
+ |
static const uint32 kInitializedMask = 0x80000000; |
static const uint32 kFileTypeMask = 0x70000000; |
static const uint32 kFileTypeOffset = 28; |