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

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

Issue 2957133002: Implement in-memory byte hints in SimpleCache (Closed)
Patch Set: Adjust to the interface's naming change. Created 3 years, 4 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_version.h ('k') | net/disk_cache/simple/simple_index.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 9e6df0a745647d1db9396b78895a82e5665b89f3..4c1119aa4a7e3a7915b2e5ccbed4a4d53599c907 100644
--- a/net/disk_cache/simple/simple_index.h
+++ b/net/disk_cache/simple/simple_index.h
@@ -59,9 +59,12 @@ class NET_EXPORT_PRIVATE EntryMetadata {
uint32_t GetEntrySize() const;
void SetEntrySize(base::StrictNumeric<uint32_t> entry_size);
+ uint8_t GetInMemoryData() const { return in_memory_data_; }
+ void SetInMemoryData(uint8_t val) { in_memory_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_entry_in_memory_data);
static base::TimeDelta GetLowerEpsilonForTimeComparisons() {
return base::TimeDelta::FromSeconds(1);
@@ -80,7 +83,8 @@ 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.
+ uint32_t entry_size_256b_chunks_ : 24; // in 256-byte blocks, rounded up.
+ uint32_t in_memory_data_ : 8;
};
static_assert(sizeof(EntryMetadata) == 8, "incorrect metadata size");
@@ -129,6 +133,9 @@ class NET_EXPORT_PRIVATE SimpleIndex
// iff the entry exist in the index.
bool UseIfExists(uint64_t entry_hash);
+ uint8_t GetEntryInMemoryData(uint64_t entry_hash) const;
+ void SetEntryInMemoryData(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
« no previous file with comments | « net/disk_cache/simple/simple_backend_version.h ('k') | net/disk_cache/simple/simple_index.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698