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

Unified Diff: net/disk_cache/simple/simple_disk_format.h

Issue 13839011: Asynchronous initialization in Simple Index. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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
« no previous file with comments | « net/disk_cache/simple/simple_backend_impl.cc ('k') | net/disk_cache/simple/simple_disk_format.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..2e69f878cd21913eafaedec9d0011a154bb40eb5 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 EntryMetadata instances.
+ // 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().
« no previous file with comments | « net/disk_cache/simple/simple_backend_impl.cc ('k') | net/disk_cache/simple/simple_disk_format.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698