| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/mem_backend_impl.h" | 5 #include "net/disk_cache/mem_backend_impl.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/sys_info.h" | 8 #include "base/sys_info.h" |
| 9 #include "net/base/net_errors.h" | 9 #include "net/base/net_errors.h" |
| 10 #include "net/disk_cache/cache_util.h" | 10 #include "net/disk_cache/cache_util.h" |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 } | 193 } |
| 194 | 194 |
| 195 int MemBackendImpl::OpenNextEntry(void** iter, Entry** next_entry, | 195 int MemBackendImpl::OpenNextEntry(void** iter, Entry** next_entry, |
| 196 OldCompletionCallback* callback) { | 196 OldCompletionCallback* callback) { |
| 197 if (OpenNextEntry(iter, next_entry)) | 197 if (OpenNextEntry(iter, next_entry)) |
| 198 return net::OK; | 198 return net::OK; |
| 199 | 199 |
| 200 return net::ERR_FAILED; | 200 return net::ERR_FAILED; |
| 201 } | 201 } |
| 202 | 202 |
| 203 int MemBackendImpl::OpenNextEntry(void** iter, Entry** next_entry, |
| 204 const net::CompletionCallback& callback) { |
| 205 if (OpenNextEntry(iter, next_entry)) |
| 206 return net::OK; |
| 207 |
| 208 return net::ERR_FAILED; |
| 209 } |
| 210 |
| 203 void MemBackendImpl::EndEnumeration(void** iter) { | 211 void MemBackendImpl::EndEnumeration(void** iter) { |
| 204 *iter = NULL; | 212 *iter = NULL; |
| 205 } | 213 } |
| 206 | 214 |
| 207 void MemBackendImpl::OnExternalCacheHit(const std::string& key) { | 215 void MemBackendImpl::OnExternalCacheHit(const std::string& key) { |
| 208 EntryMap::iterator it = entries_.find(key); | 216 EntryMap::iterator it = entries_.find(key); |
| 209 if (it != entries_.end()) { | 217 if (it != entries_.end()) { |
| 210 UpdateRank(it->second); | 218 UpdateRank(it->second); |
| 211 } | 219 } |
| 212 } | 220 } |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 if (current_size_ > max_size_) | 342 if (current_size_ > max_size_) |
| 335 TrimCache(false); | 343 TrimCache(false); |
| 336 } | 344 } |
| 337 | 345 |
| 338 void MemBackendImpl::SubstractStorageSize(int32 bytes) { | 346 void MemBackendImpl::SubstractStorageSize(int32 bytes) { |
| 339 current_size_ -= bytes; | 347 current_size_ -= bytes; |
| 340 DCHECK_GE(current_size_, 0); | 348 DCHECK_GE(current_size_, 0); |
| 341 } | 349 } |
| 342 | 350 |
| 343 } // namespace disk_cache | 351 } // namespace disk_cache |
| OLD | NEW |