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

Unified Diff: net/http/mock_http_cache.cc

Issue 2721933002: HttpCache::Transaction layer allowing parallel validation (Closed)
Patch Set: Josh's latest feedback addressed Created 3 years, 8 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/http_cache_unittest.cc ('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 902095aa13f73a2488cb11cb750b5292f8b64977..c27e98b44c8437bbb3f8ec64ece83fcffc0f56fd 100644
--- a/net/http/mock_http_cache.cc
+++ b/net/http/mock_http_cache.cc
@@ -532,6 +532,13 @@ void MockDiskCache::CallbackLater(const CompletionCallback& callback,
FROM_HERE, base::Bind(&CallbackForwader, callback, result));
}
+bool MockDiskCache::IsDiskEntryDoomed(const std::string& key) {
+ auto it = entries_.find(key);
+ if (it == entries_.end())
+ return false;
+ return it->second->is_doomed();
+}
+
//-----------------------------------------------------------------------------
int MockBackendFactory::CreateBackend(
@@ -645,6 +652,41 @@ void MockHttpCache::SetTestMode(int test_mode) {
g_test_mode = test_mode;
}
+bool MockHttpCache::IsWriterPresent(const std::string& key) {
+ HttpCache::ActiveEntry* entry = http_cache_.FindActiveEntry(key);
+ if (entry)
+ return entry->writer;
+ return false;
+}
+
+bool MockHttpCache::IsHeadersTransactionPresent(const std::string& key) {
+ HttpCache::ActiveEntry* entry = http_cache_.FindActiveEntry(key);
+ if (entry)
+ return entry->headers_transaction;
+ return false;
+}
+
+int MockHttpCache::GetCountReaders(const std::string& key) {
+ HttpCache::ActiveEntry* entry = http_cache_.FindActiveEntry(key);
+ if (entry)
+ return entry->readers.size();
+ return false;
+}
+
+int MockHttpCache::GetCountAddToEntryQueue(const std::string& key) {
+ HttpCache::ActiveEntry* entry = http_cache_.FindActiveEntry(key);
+ if (entry)
+ return entry->add_to_entry_queue.size();
+ return false;
+}
+
+int MockHttpCache::GetCountDoneHeadersQueue(const std::string& key) {
+ HttpCache::ActiveEntry* entry = http_cache_.FindActiveEntry(key);
+ if (entry)
+ return entry->done_headers_queue.size();
+ return false;
+}
+
//-----------------------------------------------------------------------------
int MockDiskCacheNoCB::CreateEntry(const std::string& key,
« net/http/http_cache_unittest.cc ('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