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

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

Issue 14746019: net/disk_cache/simple: Reduce size of EntrySet nodes. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix two failing unit tests Created 7 years, 7 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 a2913202276b22ef724a04abb6ffd0cdc34aa419..1e78d4a85f1ed07934e970b06274562f9f20afd7 100644
--- a/net/disk_cache/simple/simple_index_file.cc
+++ b/net/disk_cache/simple/simple_index_file.cc
@@ -111,12 +111,15 @@ scoped_ptr<SimpleIndex::EntrySet> SimpleIndexFile::Deserialize(const char* data,
scoped_ptr<SimpleIndex::EntrySet> index_file_entries(
new SimpleIndex::EntrySet());
while (index_file_entries->size() < index_metadata.GetNumberOfEntries()) {
+ uint64 hash_key;
EntryMetadata entry_metadata;
- if (!entry_metadata.Deserialize(&pickle_it)) {
+ if (!pickle_it.ReadUInt64(&hash_key) ||
+ !entry_metadata.Deserialize(&pickle_it)) {
LOG(WARNING) << "Invalid EntryMetadata in Simple Index file.";
return scoped_ptr<SimpleIndex::EntrySet>(NULL);
}
- SimpleIndex::InsertInEntrySet(entry_metadata, index_file_entries.get());
+ SimpleIndex::InsertInEntrySet(
+ hash_key, entry_metadata, index_file_entries.get());
}
return index_file_entries.Pass();
@@ -131,6 +134,7 @@ scoped_ptr<Pickle> SimpleIndexFile::Serialize(
index_metadata.Serialize(pickle.get());
for (SimpleIndex::EntrySet::const_iterator it = entries.begin();
it != entries.end(); ++it) {
+ pickle->WriteUInt64(it->first);
it->second.Serialize(pickle.get());
}
SimpleIndexFile::PickleHeader* header_p =

Powered by Google App Engine
This is Rietveld 408576698