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

Unified Diff: net/http/mock_http_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
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..198c281a6ed5234c9d09b0e03ab414f1c8ed0474 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 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; }
@@ -112,6 +115,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_;
@@ -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 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_; }
@@ -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 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; }
@@ -209,6 +221,7 @@ class MockDiskCache : public disk_cache::Backend {
bool soft_failures_;
bool double_create_check_;
bool fail_sparse_requests_;
+ bool support_memory_entry_data_;
// Used for pause and restart.
MockDiskEntry::DeferOp defer_op_;

Powered by Google App Engine
This is Rietveld 408576698