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

Unified Diff: net/http/http_cache.cc

Issue 10909136: Http Cache: Add code for simulating an infinite HTTP cache. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 3 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/http_cache.cc
===================================================================
--- net/http/http_cache.cc (revision 155282)
+++ net/http/http_cache.cc (working copy)
@@ -19,6 +19,7 @@
#include "base/location.h"
#include "base/memory/ref_counted.h"
#include "base/message_loop.h"
+#include "base/metrics/field_trial.h"
#include "base/pickle.h"
#include "base/stl_util.h"
#include "base/string_number_conversions.h"
@@ -409,7 +410,7 @@
CreateBackend(NULL, net::CompletionCallback());
}
- HttpCache::Transaction* trans = new HttpCache::Transaction(this, NULL);
+ HttpCache::Transaction* trans = new HttpCache::Transaction(this, NULL, NULL);
MetadataWriter* writer = new MetadataWriter(trans);
// The writer will self destruct when done.
@@ -444,6 +445,13 @@
disk_cache_->OnExternalCacheHit(key);
}
+void HttpCache::InitializeInfiniteCache(const FilePath& path) {
+ if (base::FieldTrialList::FindFullName("InfiniteCache") != "Yes")
+ return;
+ // To be enabled after everything is fully wired.
+ // infinite_cache_.Init(path);
+}
+
int HttpCache::CreateTransaction(scoped_ptr<HttpTransaction>* trans,
HttpTransactionDelegate* delegate) {
// Do lazy initialization of disk cache if needed.
@@ -452,7 +460,10 @@
CreateBackend(NULL, net::CompletionCallback());
}
- trans->reset(new HttpCache::Transaction(this, delegate));
+ InfiniteCacheTransaction* infinite_cache_transaction =
+ infinite_cache_.CreateInfiniteCacheTransaction();
+ trans->reset(new HttpCache::Transaction(this, delegate,
+ infinite_cache_transaction));
return OK;
}

Powered by Google App Engine
This is Rietveld 408576698