Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/file_util.h" | 5 #include "base/file_util.h" |
| 6 #include "base/metrics/field_trial.h" | 6 #include "base/metrics/field_trial.h" |
| 7 #include "base/stringprintf.h" | 7 #include "base/stringprintf.h" |
| 8 #include "net/base/net_errors.h" | 8 #include "net/base/net_errors.h" |
| 9 #include "net/disk_cache/backend_impl.h" | 9 #include "net/disk_cache/backend_impl.h" |
| 10 #include "net/disk_cache/cache_util.h" | 10 #include "net/disk_cache/cache_util.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 74 | 74 |
| 75 CacheCreator::~CacheCreator() { | 75 CacheCreator::~CacheCreator() { |
| 76 } | 76 } |
| 77 | 77 |
| 78 int CacheCreator::Run() { | 78 int CacheCreator::Run() { |
| 79 // TODO(pasko): The two caches should never coexist on disk. Each individual | 79 // TODO(pasko): The two caches should never coexist on disk. Each individual |
| 80 // cache backend should fail to initialize if it observes the index that does | 80 // cache backend should fail to initialize if it observes the index that does |
| 81 // not belong to it. | 81 // not belong to it. |
| 82 const std::string experiment_name = | 82 const std::string experiment_name = |
| 83 base::FieldTrialList::FindFullName("SimpleCacheTrial"); | 83 base::FieldTrialList::FindFullName("SimpleCacheTrial"); |
| 84 | |
| 85 if (type_ == net::DISK_CACHE) { | |
|
pasko-google - do not use
2013/05/02 15:29:35
I thought you would change this in a separate CL,
gavinp
2013/05/02 15:32:40
I recommended he do this; I thought it would be ni
pasko-google - do not use
2013/05/02 15:35:55
sry, I normally do not look at patch set names, pr
| |
| 86 disk_cache::SimpleBackendImpl* simple_cache = | |
| 87 new disk_cache::SimpleBackendImpl(path_, max_bytes_, type_, thread_, | |
| 88 net_log_); | |
| 89 created_cache_ = simple_cache; | |
| 90 return simple_cache->Init( | |
| 91 base::Bind(&CacheCreator::OnIOComplete, base::Unretained(this))); | |
| 92 } | |
| 93 | |
| 84 if (experiment_name == "ExplicitYes" || experiment_name == "ExperimentYes" || | 94 if (experiment_name == "ExplicitYes" || experiment_name == "ExperimentYes" || |
| 85 experiment_name == "ExperimentYes2") { | 95 experiment_name == "ExperimentYes2") { |
| 86 // TODO(gavinp,pasko): While simple backend development proceeds, we're only | 96 // TODO(gavinp,pasko): While simple backend development proceeds, we're only |
| 87 // testing it against net::DISK_CACHE. Turn it on for more cache types as | 97 // testing it against net::DISK_CACHE. Turn it on for more cache types as |
| 88 // appropriate. | 98 // appropriate. |
| 89 if (type_ == net::DISK_CACHE) { | 99 if (type_ == net::DISK_CACHE) { |
| 90 disk_cache::SimpleBackendImpl* simple_cache = | 100 disk_cache::SimpleBackendImpl* simple_cache = |
| 91 new disk_cache::SimpleBackendImpl(path_, max_bytes_, type_, thread_, | 101 new disk_cache::SimpleBackendImpl(path_, max_bytes_, type_, thread_, |
| 92 net_log_); | 102 net_log_); |
| 93 created_cache_ = simple_cache; | 103 created_cache_ = simple_cache; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 158 *backend = disk_cache::MemBackendImpl::CreateBackend(max_bytes, net_log); | 168 *backend = disk_cache::MemBackendImpl::CreateBackend(max_bytes, net_log); |
| 159 return *backend ? net::OK : net::ERR_FAILED; | 169 return *backend ? net::OK : net::ERR_FAILED; |
| 160 } | 170 } |
| 161 DCHECK(thread); | 171 DCHECK(thread); |
| 162 CacheCreator* creator = new CacheCreator(path, force, max_bytes, type, kNone, | 172 CacheCreator* creator = new CacheCreator(path, force, max_bytes, type, kNone, |
| 163 thread, net_log, backend, callback); | 173 thread, net_log, backend, callback); |
| 164 return creator->Run(); | 174 return creator->Run(); |
| 165 } | 175 } |
| 166 | 176 |
| 167 } // namespace disk_cache | 177 } // namespace disk_cache |
| OLD | NEW |