summaryrefslogtreecommitdiffstats
path: root/net/http/http_cache.cc
diff options
context:
space:
mode:
authorrvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-25 23:44:20 +0000
committerrvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-25 23:44:20 +0000
commit6192f73a9dd17c950ef1ca97db086e8bc4eaf05e (patch)
tree7af372f9670e74b144d17f1f7c009a9eb13a74a2 /net/http/http_cache.cc
parent1ba590018ad58ea18ec3079f089feb64fd951d87 (diff)
downloadchromium_src-6192f73a9dd17c950ef1ca97db086e8bc4eaf05e.zip
chromium_src-6192f73a9dd17c950ef1ca97db086e8bc4eaf05e.tar.gz
chromium_src-6192f73a9dd17c950ef1ca97db086e8bc4eaf05e.tar.bz2
Disk cache: First pass to make it possible to have
multiple instances of BackendImpl. We need multiple objects to be able to support media files on the cache. After this change, histograms will be the only thing that get messed up by multiple disk caches. Review URL: http://codereview.chromium.org/49027 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12520 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/http/http_cache.cc')
-rw-r--r--net/http/http_cache.cc16
1 files changed, 8 insertions, 8 deletions
diff --git a/net/http/http_cache.cc b/net/http/http_cache.cc
index be1347c..38a8f23 100644
--- a/net/http/http_cache.cc
+++ b/net/http/http_cache.cc
@@ -583,7 +583,7 @@ void HttpCache::Transaction::SetRequest(const HttpRequestInfo* request) {
// If HttpCache has type MEDIA make sure LOAD_ENABLE_DOWNLOAD_FILE is set,
// otherwise make sure LOAD_ENABLE_DOWNLOAD_FILE is not set when HttpCache
// has type other than MEDIA.
- if (cache_->type() == HttpCache::MEDIA) {
+ if (cache_->type() == MEDIA_CACHE) {
DCHECK(effective_load_flags_ & LOAD_ENABLE_DOWNLOAD_FILE);
} else {
DCHECK(!(effective_load_flags_ & LOAD_ENABLE_DOWNLOAD_FILE));
@@ -782,7 +782,7 @@ int HttpCache::Transaction::ReadResponseInfoFromEntry() {
// If the cache object is used for media file, we want the file handle of
// response data.
- if (cache_->type() == HttpCache::MEDIA) {
+ if (cache_->type() == MEDIA_CACHE) {
response_.response_data_file =
entry_->disk_entry->GetPlatformFile(kResponseContentIndex);
}
@@ -856,7 +856,7 @@ void HttpCache::Transaction::TruncateResponseData() {
// if we get a valid response from server, i.e. 200. We don't want empty
// cache files for redirection or external files for erroneous requests.
response_.response_data_file = base::kInvalidPlatformFileValue;
- if (cache_->type() == HttpCache::MEDIA) {
+ if (cache_->type() == MEDIA_CACHE) {
response_.response_data_file =
entry_->disk_entry->UseExternalFile(kResponseContentIndex);
}
@@ -977,7 +977,7 @@ HttpCache::HttpCache(ProxyService* proxy_service,
int cache_size)
: disk_cache_dir_(cache_dir),
mode_(NORMAL),
- type_(COMMON),
+ type_(DISK_CACHE),
network_layer_(HttpNetworkLayer::CreateFactory(proxy_service)),
ALLOW_THIS_IN_INITIALIZER_LIST(task_factory_(this)),
in_memory_cache_(false),
@@ -989,7 +989,7 @@ HttpCache::HttpCache(HttpNetworkSession* session,
int cache_size)
: disk_cache_dir_(cache_dir),
mode_(NORMAL),
- type_(COMMON),
+ type_(DISK_CACHE),
network_layer_(HttpNetworkLayer::CreateFactory(session)),
ALLOW_THIS_IN_INITIALIZER_LIST(task_factory_(this)),
in_memory_cache_(false),
@@ -998,7 +998,7 @@ HttpCache::HttpCache(HttpNetworkSession* session,
HttpCache::HttpCache(ProxyService* proxy_service, int cache_size)
: mode_(NORMAL),
- type_(COMMON),
+ type_(MEMORY_CACHE),
network_layer_(HttpNetworkLayer::CreateFactory(proxy_service)),
ALLOW_THIS_IN_INITIALIZER_LIST(task_factory_(this)),
in_memory_cache_(true),
@@ -1008,7 +1008,7 @@ HttpCache::HttpCache(ProxyService* proxy_service, int cache_size)
HttpCache::HttpCache(HttpTransactionFactory* network_layer,
disk_cache::Backend* disk_cache)
: mode_(NORMAL),
- type_(COMMON),
+ type_(DISK_CACHE),
network_layer_(network_layer),
disk_cache_(disk_cache),
ALLOW_THIS_IN_INITIALIZER_LIST(task_factory_(this)),
@@ -1046,7 +1046,7 @@ HttpTransaction* HttpCache::CreateTransaction() {
disk_cache_.reset(disk_cache::CreateInMemoryCacheBackend(cache_size_));
} else if (!disk_cache_dir_.empty()) {
disk_cache_.reset(disk_cache::CreateCacheBackend(disk_cache_dir_, true,
- cache_size_));
+ cache_size_, type_));
disk_cache_dir_.clear(); // Reclaim memory.
}
}