| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "net/disk_cache/simple/simple_backend_impl.h" | 5 #include "net/disk_cache/simple/simple_backend_impl.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 if (result == net::OK) | 126 if (result == net::OK) |
| 127 UMA_HISTOGRAM_TIMES("SimpleCache.CreationToIndex", creation_to_index); | 127 UMA_HISTOGRAM_TIMES("SimpleCache.CreationToIndex", creation_to_index); |
| 128 else | 128 else |
| 129 UMA_HISTOGRAM_TIMES("SimpleCache.CreationToIndexFail", creation_to_index); | 129 UMA_HISTOGRAM_TIMES("SimpleCache.CreationToIndexFail", creation_to_index); |
| 130 } | 130 } |
| 131 | 131 |
| 132 } // namespace | 132 } // namespace |
| 133 | 133 |
| 134 namespace disk_cache { | 134 namespace disk_cache { |
| 135 | 135 |
| 136 SimpleBackendImpl::SimpleBackendImpl( | 136 SimpleBackendImpl::SimpleBackendImpl(const FilePath& path, |
| 137 const FilePath& path, | 137 int max_bytes, |
| 138 int max_bytes, | 138 net::CacheType type, |
| 139 net::CacheType type, | 139 base::SingleThreadTaskRunner* cache_thread, |
| 140 base::SingleThreadTaskRunner* cache_thread, | 140 net::NetLog* net_log) |
| 141 net::NetLog* net_log) | |
| 142 : path_(path), | 141 : path_(path), |
| 143 index_(new SimpleIndex(MessageLoopProxy::current(), // io_thread | 142 index_(new SimpleIndex(MessageLoopProxy::current(), // io_thread |
| 144 path, | 143 path, |
| 145 scoped_ptr<SimpleIndexFile>( | 144 scoped_ptr<SimpleIndexFile>( |
| 146 new SimpleIndexFile(cache_thread, path)))), | 145 new SimpleIndexFile(cache_thread, path)))), |
| 147 cache_thread_(cache_thread), | 146 cache_thread_(cache_thread), |
| 148 orig_max_size_(max_bytes) { | 147 orig_max_size_(max_bytes) { |
| 149 index_->ExecuteWhenReady(base::Bind(&RecordIndexLoad, | 148 index_->ExecuteWhenReady(base::Bind(&RecordIndexLoad, |
| 150 base::TimeTicks::Now())); | 149 base::TimeTicks::Now())); |
| 151 } | 150 } |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 // currently active entry. | 344 // currently active entry. |
| 346 if (key != it->second->key()) { | 345 if (key != it->second->key()) { |
| 347 it->second->Doom(); | 346 it->second->Doom(); |
| 348 DCHECK_EQ(0U, active_entries_.count(entry_hash)); | 347 DCHECK_EQ(0U, active_entries_.count(entry_hash)); |
| 349 return CreateOrFindActiveEntry(key); | 348 return CreateOrFindActiveEntry(key); |
| 350 } | 349 } |
| 351 return make_scoped_refptr(it->second.get()); | 350 return make_scoped_refptr(it->second.get()); |
| 352 } | 351 } |
| 353 | 352 |
| 354 } // namespace disk_cache | 353 } // namespace disk_cache |
| OLD | NEW |