Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1691)

Unified Diff: net/disk_cache/simple/simple_index_file.cc

Issue 2922973003: RFC: use some in-memory state in SimpleCache to quickly cache-miss some CantConditionalize cases
Patch Set: omewhat better take at higher-level HC::T impl, a bit lessy hacky, and actually write to cache now. Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: net/disk_cache/simple/simple_index_file.cc
diff --git a/net/disk_cache/simple/simple_index_file.cc b/net/disk_cache/simple/simple_index_file.cc
index 01eaba1e00cd1ca1753b416e5fa171ca61dc9441..550c5f2ee9a5d4cb30d557c3132e0627151bb12b 100644
--- a/net/disk_cache/simple/simple_index_file.cc
+++ b/net/disk_cache/simple/simple_index_file.cc
@@ -340,11 +340,12 @@ bool SimpleIndexFile::IndexMetadata::CheckIndexMetadata() {
return false;
}
- static_assert(kSimpleVersion == 7, "index metadata reader out of date");
+ static_assert(kSimpleVersion == 8, "index metadata reader out of date");
// No |reason_| is saved in the version 6 file format.
if (version_ == 6)
return reason_ == SimpleIndex::INDEX_WRITE_REASON_MAX;
- return version_ == 7 && reason_ < SimpleIndex::INDEX_WRITE_REASON_MAX;
+ return (version_ == 7 || version_ == 8) &&
+ reason_ < SimpleIndex::INDEX_WRITE_REASON_MAX;
}
SimpleIndexFile::SimpleIndexFile(
@@ -559,7 +560,8 @@ void SimpleIndexFile::Deserialize(const char* data, int data_len,
uint64_t hash_key;
EntryMetadata entry_metadata;
if (!pickle_it.ReadUInt64(&hash_key) ||
- !entry_metadata.Deserialize(&pickle_it)) {
+ !entry_metadata.Deserialize(&pickle_it,
+ index_metadata.has_memory_entry_data())) {
LOG(WARNING) << "Invalid EntryMetadata in Simple Index file.";
entries->clear();
return;

Powered by Google App Engine
This is Rietveld 408576698