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..d076a5d7e126d450474a86be2ad46111e72e183b 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() { |
| @@ -87,11 +85,12 @@ int CacheCreator::Run() { |
| // appropriate. |
| if (type_ == net::DISK_CACHE) { |
| VLOG(1) << "Using the Simple Cache Backend."; |
|
gavinp
2013/04/09 16:03:49
Maybe lose this VLOG?
pasko-google - do not use
2013/04/09 16:20:48
Done.
|
| - 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 +108,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 |
| - *backend_ = new disk_cache::TracingCacheBackend(*backend_); |
| + *backend_ = new disk_cache::TracingCacheBackend(created_cache_); |
|
gavinp
2013/04/09 16:03:49
This change looks like a NOP. Is it a NOP?
pasko-google - do not use
2013/04/09 16:20:48
It is based on another change (https://codereview.
|
| #endif |
| } else { |
| LOG(ERROR) << "Unable to create cache"; |