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

Unified Diff: net/disk_cache/disk_cache.h

Issue 2958033002: Interface for associating in-memory hint bytes with disk cache entries. (Closed)
Patch Set: Reword comment based on Gavin's feedback; rebase 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 | « no previous file | net/disk_cache/disk_cache.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/disk_cache/disk_cache.h
diff --git a/net/disk_cache/disk_cache.h b/net/disk_cache/disk_cache.h
index dbafe94f440d46fd5bc7354452980127708fdad8..bab0c6344254af9f92b603a0ced5d09bc78db22a 100644
--- a/net/disk_cache/disk_cache.h
+++ b/net/disk_cache/disk_cache.h
@@ -223,6 +223,21 @@ class NET_EXPORT Backend {
virtual size_t DumpMemoryStats(
base::trace_event::ProcessMemoryDump* pmd,
const std::string& parent_absolute_name) const = 0;
+
+ // Backends can optionally permit one to store, probabilistically, up to a
+ // byte associated with a key of an existing entry in memory.
+
+ // GetMemoryEntryData has the following behavior:
+ // - If the data is not available at this time for any reason, returns 0.
+ // - Otherwise, returns a value that was with very high probability
+ // given to SetMemoryEntryData(|key|) (and with a very low probability
+ // to a different key that collides in the in-memory index).
+ //
+ // Due to the probability of collisions, including those that can be induced
+ // by hostile 3rd parties, this interface should not be used to make decisions
+ // that affect correctness (especially security).
+ virtual uint8_t GetMemoryEntryData(const std::string& key);
Maks Orlovich 2017/08/23 19:18:11 Suggestion from the impl CL: pasko 2017/06/29 16:
Maks Orlovich 2017/08/25 18:36:26 Done.
+ virtual void SetMemoryEntryData(const std::string& key, uint8_t data);
};
// This interface represents an entry in the disk cache.
« no previous file with comments | « no previous file | net/disk_cache/disk_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698