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

Unified Diff: net/http/mock_http_cache.h

Issue 2958033002: Interface for associating in-memory hint bytes with disk cache entries. (Closed)
Patch Set: 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 | « net/disk_cache/disk_cache.cc ('k') | net/http/mock_http_cache.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/mock_http_cache.h
diff --git a/net/http/mock_http_cache.h b/net/http/mock_http_cache.h
index bc7847b7bfff8b541ada5049b7a6c2453141b661..97bfded034d76bb41dc5fd360cff9b7d1d688544 100644
--- a/net/http/mock_http_cache.h
+++ b/net/http/mock_http_cache.h
@@ -70,6 +70,9 @@ class MockDiskEntry : public disk_cache::Entry,
void CancelSparseIO() override;
int ReadyForSparseIO(const CompletionCallback& completion_callback) override;
+ uint8_t in_memory_data() const { return in_memory_data_; }
+ void set_in_memory_data(uint8_t val) { in_memory_data_ = val; }
+
// Fail most subsequent requests.
void set_fail_requests() { fail_requests_ = true; }
@@ -112,6 +115,7 @@ class MockDiskEntry : public disk_cache::Entry,
std::string key_;
std::vector<char> data_[kNumCacheEntryDataIndices];
+ uint8_t in_memory_data_;
int test_mode_;
bool doomed_;
bool sparse_;
@@ -157,6 +161,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 GetEntryInMemoryData(const std::string& key) override;
+ void SetEntryInMemoryData(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_; }
@@ -176,6 +182,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 GetEntryInMemoryData/SetEntryInMemoryData
+ // interface. Default is true.
+ void set_support_in_memory_entry_data(bool value) {
+ support_in_memory_entry_data_ = value;
+ }
+
// Makes all requests for data ranges to fail as not implemented.
void set_fail_sparse_requests() { fail_sparse_requests_ = true; }
@@ -209,6 +221,7 @@ class MockDiskCache : public disk_cache::Backend {
bool soft_failures_;
bool double_create_check_;
bool fail_sparse_requests_;
+ bool support_in_memory_entry_data_;
// Used for pause and restart.
MockDiskEntry::DeferOp defer_op_;
« no previous file with comments | « net/disk_cache/disk_cache.cc ('k') | net/http/mock_http_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698