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

Unified Diff: net/disk_cache/disk_cache.h

Issue 2958033002: Interface for associating in-memory hint bytes with disk cache entries. (Closed)
Patch Set: Created 3 years, 6 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') | net/http/mock_http_cache.h » ('J')
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 4a3ae119b53f9c90b22f5c70379e5d4fb0f1f057..68391041610c0ae916d8c19151d8119aa5161527 100644
--- a/net/disk_cache/disk_cache.h
+++ b/net/disk_cache/disk_cache.h
@@ -184,6 +184,22 @@ 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 feature is not supported by the backend, returns 0.
+ // - If the entry is not in the cache, returns 0.
Randy Smith (Not in Mondays) 2017/06/27 21:33:56 Definitively isn't in the cache, or isn't in the i
Maks Orlovich 2017/06/28 13:54:31 Hmm, good point. It's actually sort of a mixture e
gavinp 2017/08/04 17:33:14 This is subtle; because of course yes we can opera
Maks Orlovich 2017/08/23 18:52:05 Rephrased, but added "at this time".
+ // - 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).
Randy Smith (Not in Mondays) 2017/06/27 21:33:55 Hmmm. I'd rather have an interface that distingui
Maks Orlovich 2017/06/28 13:54:31 Not sure how you would use that.
+ //
+ // 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);
+ 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') | net/http/mock_http_cache.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698