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

Unified Diff: net/http/mock_http_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
Index: net/http/mock_http_cache.h
diff --git a/net/http/mock_http_cache.h b/net/http/mock_http_cache.h
index ca0730429f7b401e18987acdf31a3859991b62f0..d768d43608f4408bbc3786a179d3bf79c8199862 100644
--- a/net/http/mock_http_cache.h
+++ b/net/http/mock_http_cache.h
@@ -64,6 +64,9 @@ class MockDiskEntry : public disk_cache::Entry,
void CancelSparseIO() override;
int ReadyForSparseIO(const CompletionCallback& completion_callback) override;
+ uint8_t memory_entry_data() const { return memory_entry_data_; }
+ void set_memory_entry_data(uint8_t val) { memory_entry_data_ = val; }
+
// Fail most subsequent requests.
void set_fail_requests() { fail_requests_ = true; }
@@ -98,6 +101,7 @@ class MockDiskEntry : public disk_cache::Entry,
std::string key_;
std::vector<char> data_[kNumCacheEntryDataIndices];
+ unsigned char memory_entry_data_;
int test_mode_;
bool doomed_;
bool sparse_;
@@ -137,6 +141,8 @@ class MockDiskCache : public disk_cache::Backend {
size_t DumpMemoryStats(
base::trace_event::ProcessMemoryDump* pmd,
const std::string& parent_absolute_name) const override;
+ uint8_t GetMemoryEntryData(const std::string& key) override;
+ void SetMemoryEntryData(const std::string& key, uint8_t data) override;
// Returns number of times a cache entry was successfully opened.
int open_count() const { return open_count_; }
@@ -153,6 +159,12 @@ class MockDiskCache : public disk_cache::Backend {
// Makes sure that CreateEntry is not called twice for a given key.
void set_double_create_check(bool value) { double_create_check_ = value; }
+ // Determines whether to provide the GetMemoryEntryData/SetMemoryEntryData
+ // interface. Default is true
+ void set_support_memory_entry_data(bool value) {
+ support_memory_entry_data_ = value;
+ }
+
// Makes all requests for data ranges to fail as not implemented.
void set_fail_sparse_requests() { fail_sparse_requests_ = true; }
@@ -173,6 +185,7 @@ class MockDiskCache : public disk_cache::Backend {
bool soft_failures_;
bool double_create_check_;
bool fail_sparse_requests_;
+ bool support_memory_entry_data_;
gavinp 2017/08/04 17:33:14 This CL could be a good chance to switch to in-cla
Maks Orlovich 2017/08/23 18:52:06 Not a fan of mixing in very wide-scale cleanups...
};
class MockBackendFactory : public HttpCache::BackendFactory {

Powered by Google App Engine
This is Rietveld 408576698