Chromium Code Reviews| Index: net/disk_cache/cache_creator.cc |
| diff --git a/net/disk_cache/cache_creator.cc b/net/disk_cache/cache_creator.cc |
| index b1a77dd22ef4485b1225bf64c798673fb56764d2..52bf55922d0aff4bc2f78c9087c2cd95bc734a60 100644 |
| --- a/net/disk_cache/cache_creator.cc |
| +++ b/net/disk_cache/cache_creator.cc |
| @@ -49,7 +49,6 @@ class CacheCreator { |
| net::CompletionCallback callback_; |
| disk_cache::Backend* created_cache_; |
| net::NetLog* net_log_; |
| - bool use_simple_cache_backend_; |
| DISALLOW_COPY_AND_ASSIGN(CacheCreator); |
| }; |
| @@ -70,8 +69,7 @@ CacheCreator::CacheCreator( |
| backend_(backend), |
| callback_(callback), |
| created_cache_(NULL), |
| - net_log_(net_log), |
| - use_simple_cache_backend_(false) { |
| + net_log_(net_log) { |
| } |
| CacheCreator::~CacheCreator() { |
| @@ -86,12 +84,12 @@ int CacheCreator::Run() { |
| // testing it against net::DISK_CACHE. Turn it on for more cache types as |
| // appropriate. |
| if (type_ == net::DISK_CACHE) { |
| - VLOG(1) << "Using the Simple Cache Backend."; |
| - use_simple_cache_backend_ = true; |
| - return disk_cache::SimpleBackendImpl::CreateBackend( |
| - path_, max_bytes_, type_, disk_cache::kNone, thread_, net_log_, |
| - backend_, base::Bind(&CacheCreator::OnIOComplete, |
| - base::Unretained(this))); |
| + disk_cache::SimpleBackendImpl* simple_cache = |
| + new disk_cache::SimpleBackendImpl(path_, max_bytes_, type_, thread_, |
| + net_log_); |
| + created_cache_ = simple_cache; |
| + return simple_cache->Init( |
| + base::Bind(&CacheCreator::OnIOComplete, base::Unretained(this))); |
| } |
| } |
| disk_cache::BackendImpl* new_cache = |
| @@ -109,14 +107,9 @@ int CacheCreator::Run() { |
| void CacheCreator::DoCallback(int result) { |
| DCHECK_NE(net::ERR_IO_PENDING, result); |
| if (result == net::OK) { |
| - // TODO(pasko): Separate creation of the Simple Backend from its |
| - // initialization, eliminate unnecessary use_simple_cache_backend_. |
| - if (use_simple_cache_backend_) |
| - created_cache_ = *backend_; |
| - else |
| - *backend_ = created_cache_; |
| + *backend_ = created_cache_; |
| #ifdef USE_TRACING_CACHE_BACKEND |
|
rvargas (doing something else)
2013/04/09 19:16:07
I should not be seeing this!
gavinp
2013/04/10 10:04:39
I'm confused. Since this CL is downstream from htt
rvargas (doing something else)
2013/04/10 18:50:11
No, I'm not saying that I don't understand what th
|
| - *backend_ = new disk_cache::TracingCacheBackend(*backend_); |
| + *backend_ = new disk_cache::TracingCacheBackend(created_cache_); |
| #endif |
| } else { |
| LOG(ERROR) << "Unable to create cache"; |