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

Unified Diff: net/http/mock_http_cache.cc

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
« net/http/mock_http_cache.h ('K') | « net/http/mock_http_cache.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/mock_http_cache.cc
diff --git a/net/http/mock_http_cache.cc b/net/http/mock_http_cache.cc
index 5363d3af29dd0067ce58b9cd9489b40f2b545b16..4504b9770ec4971a590b9eb9ffcadcd661a974f5 100644
--- a/net/http/mock_http_cache.cc
+++ b/net/http/mock_http_cache.cc
@@ -68,6 +68,7 @@ struct MockDiskEntry::CallbackInfo {
MockDiskEntry::MockDiskEntry(const std::string& key)
: key_(key),
+ memory_entry_data_(0),
doomed_(false),
sparse_(false),
fail_requests_(false),
@@ -370,10 +371,13 @@ bool MockDiskEntry::ignore_callbacks_ = false;
//-----------------------------------------------------------------------------
MockDiskCache::MockDiskCache()
- : open_count_(0), create_count_(0), fail_requests_(false),
- soft_failures_(false), double_create_check_(true),
- fail_sparse_requests_(false) {
-}
+ : open_count_(0),
+ create_count_(0),
+ fail_requests_(false),
+ soft_failures_(false),
+ double_create_check_(true),
+ fail_sparse_requests_(false),
+ support_memory_entry_data_(true) {}
MockDiskCache::~MockDiskCache() {
ReleaseAll();
@@ -521,6 +525,22 @@ size_t MockDiskCache::DumpMemoryStats(
return 0u;
}
+uint8_t MockDiskCache::GetMemoryEntryData(const std::string& key) {
+ if (!support_memory_entry_data_)
+ return 0;
+
+ EntryMap::iterator it = entries_.find(key);
+ if (it != entries_.end())
+ return it->second->memory_entry_data();
+ return 0;
+}
+
+void MockDiskCache::SetMemoryEntryData(const std::string& key, uint8_t data) {
+ EntryMap::iterator it = entries_.find(key);
+ if (it != entries_.end())
+ it->second->set_memory_entry_data(data);
+}
+
void MockDiskCache::ReleaseAll() {
EntryMap::iterator it = entries_.begin();
for (; it != entries_.end(); ++it)
« net/http/mock_http_cache.h ('K') | « net/http/mock_http_cache.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698