Index: net/disk_cache/simple/simple_disk_format.h |
diff --git a/net/disk_cache/simple/simple_disk_format.h b/net/disk_cache/simple/simple_disk_format.h |
index 18dfe9661ad00402c6407254dc58e831d4e48e33..50dacfd155400e353623c40052af0f8d28dc1516 100644 |
--- a/net/disk_cache/simple/simple_disk_format.h |
+++ b/net/disk_cache/simple/simple_disk_format.h |
@@ -59,6 +59,9 @@ namespace SimpleIndexFile { |
uint64 cache_size; // Total cache storage size in bytes. |
}; |
+ // TODO(felipeg): At some point we should consider using a protobuffer. See |
+ // that we are re-implementing most of protobuffer's functionality such as |
+ // Serialize and Merge. |
// We must keep this struct a POD. |
struct EntryMetadata { |
EntryMetadata(); |
@@ -70,12 +73,20 @@ namespace SimpleIndexFile { |
std::string GetHashKey() const; |
void SetLastUsedTime(const base::Time& last_used_time_p); |
+ // Serialize the data from |in_entry_metadata| and appends the bytes in |
+ // |out_buffer|. The serialization is platform dependent since it simply |
+ // writes the whole struct from memory into the given buffer. |
static void Serialize(const EntryMetadata& in_entry_metadata, |
std::string* out_buffer); |
static void DeSerialize(const char* in_buffer, |
EntryMetadata* out_entry_metadata); |
+ // Merge two EntryMetada instances. |
gavinp
2013/04/10 11:45:44
typo: EntryMetada -> EntryMetadata
felipeg
2013/04/10 14:21:45
Done.
|
+ // The existing valid data in |out_entry_metadata| will prevail. |
+ static void Merge(const EntryMetadata& entry_metadata, |
+ EntryMetadata* out_entry_metadata); |
+ |
char hash_key[kEntryHashKeySize]; // Not a c_string, not null terminated. |
// This is the serialized format from Time::ToInternalValue(). |