Chromium Code Reviews| 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..a0e7740a7a8bbeaa26da165b4e9e4066019132f3 100644 |
| --- a/net/disk_cache/simple/simple_index.h |
| +++ b/net/disk_cache/simple/simple_index.h |
| @@ -58,9 +58,12 @@ class NET_EXPORT_PRIVATE EntryMetadata { |
| uint32_t GetEntrySize() const; |
| void SetEntrySize(base::StrictNumeric<uint32_t> entry_size); |
| + uint8_t GetMemoryEntryData() const { return memory_entry_data_; } |
| + void SetMemoryEntryData(uint8_t val) { memory_entry_data_ = val; } |
| + |
| // 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_memory_entry_data); |
| static base::TimeDelta GetLowerEpsilonForTimeComparisons() { |
| return base::TimeDelta::FromSeconds(1); |
| @@ -79,7 +82,9 @@ 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 256-byte blocks |
|
pasko
2017/06/13 14:30:05
4K blocks, if rounded upwards would probably be ev
Maks Orlovich
2017/06/13 14:58:47
Hmm, maybe. Plus: it would also prevent things fro
|
| + uint32_t entry_size_ : 24; |
| + uint8_t memory_entry_data_ : 8; |
|
pasko
2017/06/13 14:30:05
it would be cleaner to reserve one bit that says w
Maks Orlovich
2017/06/13 14:58:47
Hmm, maybe with a bool GetMemoryEntryData(uint64_t
|
| }; |
| static_assert(sizeof(EntryMetadata) == 8, "incorrect metadata size"); |
| @@ -127,6 +132,9 @@ class NET_EXPORT_PRIVATE SimpleIndex |
| // iff the entry exist in the index. |
| bool UseIfExists(uint64_t entry_hash); |
| + uint8_t GetMemoryEntryData(uint64_t entry_hash) const; |
| + void SetMemoryEntryData(uint64_t entry_hash, uint8_t value); |
| + |
| void WriteToDisk(IndexWriteToDiskReason reason); |
| // Update the size (in bytes) of an entry, in the metadata stored in the |