Index: net/disk_cache/simple/simple_index.h |
diff --git a/net/disk_cache/simple/simple_index.h b/net/disk_cache/simple/simple_index.h |
index 6740c2c91e2b810caa5d2092d93baff6b616c85e..36f13989049b618aa24b29c5b5adcb4630a87a0b 100644 |
--- a/net/disk_cache/simple/simple_index.h |
+++ b/net/disk_cache/simple/simple_index.h |
@@ -57,10 +57,12 @@ class NET_EXPORT_PRIVATE EntryMetadata { |
uint32_t GetEntrySize() const; |
void SetEntrySize(base::StrictNumeric<uint32_t> entry_size); |
+ uint8_t GetOracleByte() const; |
+ void SetOracleByte(uint8_t oracle_byte); |
// Serialize the data into the provided pickle. |
void Serialize(base::Pickle* pickle) const; |
- bool Deserialize(base::PickleIterator* it); |
+ bool Deserialize(base::PickleIterator* it, bool has_oracle_byte); |
static base::TimeDelta GetLowerEpsilonForTimeComparisons() { |
return base::TimeDelta::FromSeconds(1); |
@@ -79,7 +81,8 @@ class NET_EXPORT_PRIVATE EntryMetadata { |
// are originally calculated as >32-bit types, the actual necessary size for |
// each shouldn't exceed 32 bits, so we use 32-bit types here. |
uint32_t last_used_time_seconds_since_epoch_; |
- uint32_t entry_size_; // Storage size in bytes. |
+ // Storage size in bytes... with oracle byte packed into lower 8 bites. |
+ uint32_t entry_size_; |
}; |
static_assert(sizeof(EntryMetadata) == 8, "incorrect metadata size"); |
@@ -123,6 +126,10 @@ class NET_EXPORT_PRIVATE SimpleIndex |
// Check whether the index has the entry given the hash of its key. |
bool Has(uint64_t entry_hash) const; |
+ // Like above, but also writes out the oracle byte (or 0) into |*oracle_byte| |
+ // if returned true. |
+ bool HasWithOracleByte(uint64_t entry_hash, uint8_t* oracle_byte); |
+ |
// Update the last used time of the entry with the given key and return true |
// iff the entry exist in the index. |
bool UseIfExists(uint64_t entry_hash); |
@@ -134,6 +141,7 @@ class NET_EXPORT_PRIVATE SimpleIndex |
// entry. |
bool UpdateEntrySize(uint64_t entry_hash, |
base::StrictNumeric<uint32_t> entry_size); |
+ void UpdateEntryOracleByte(uint64_t entry_hash, uint8_t oracle_byte); |
using EntrySet = std::unordered_map<uint64_t, EntryMetadata>; |