| 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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 } | 129 } |
| 130 | 130 |
| 131 int MemBackendImpl::OpenEntry(const std::string& key, Entry** entry, | 131 int MemBackendImpl::OpenEntry(const std::string& key, Entry** entry, |
| 132 OldCompletionCallback* callback) { | 132 OldCompletionCallback* callback) { |
| 133 if (OpenEntry(key, entry)) | 133 if (OpenEntry(key, entry)) |
| 134 return net::OK; | 134 return net::OK; |
| 135 | 135 |
| 136 return net::ERR_FAILED; | 136 return net::ERR_FAILED; |
| 137 } | 137 } |
| 138 | 138 |
| 139 int MemBackendImpl::OpenEntry(const std::string& key, Entry** entry, |
| 140 const net::CompletionCallback& callback) { |
| 141 if (OpenEntry(key, entry)) |
| 142 return net::OK; |
| 143 |
| 144 return net::ERR_FAILED; |
| 145 } |
| 146 |
| 139 int MemBackendImpl::CreateEntry(const std::string& key, Entry** entry, | 147 int MemBackendImpl::CreateEntry(const std::string& key, Entry** entry, |
| 140 OldCompletionCallback* callback) { | 148 OldCompletionCallback* callback) { |
| 141 if (CreateEntry(key, entry)) | 149 if (CreateEntry(key, entry)) |
| 142 return net::OK; | 150 return net::OK; |
| 143 | 151 |
| 144 return net::ERR_FAILED; | 152 return net::ERR_FAILED; |
| 145 } | 153 } |
| 146 | 154 |
| 155 int MemBackendImpl::CreateEntry(const std::string& key, Entry** entry, |
| 156 const net::CompletionCallback& callback) { |
| 157 if (CreateEntry(key, entry)) |
| 158 return net::OK; |
| 159 |
| 160 return net::ERR_FAILED; |
| 161 } |
| 162 |
| 147 int MemBackendImpl::DoomEntry(const std::string& key, | 163 int MemBackendImpl::DoomEntry(const std::string& key, |
| 148 OldCompletionCallback* callback) { | 164 OldCompletionCallback* callback) { |
| 149 if (DoomEntry(key)) | 165 if (DoomEntry(key)) |
| 150 return net::OK; | 166 return net::OK; |
| 151 | 167 |
| 152 return net::ERR_FAILED; | 168 return net::ERR_FAILED; |
| 153 } | 169 } |
| 154 | 170 |
| 155 int MemBackendImpl::DoomAllEntries(OldCompletionCallback* callback) { | 171 int MemBackendImpl::DoomAllEntries(OldCompletionCallback* callback) { |
| 156 if (DoomAllEntries()) | 172 if (DoomAllEntries()) |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 if (current_size_ > max_size_) | 334 if (current_size_ > max_size_) |
| 319 TrimCache(false); | 335 TrimCache(false); |
| 320 } | 336 } |
| 321 | 337 |
| 322 void MemBackendImpl::SubstractStorageSize(int32 bytes) { | 338 void MemBackendImpl::SubstractStorageSize(int32 bytes) { |
| 323 current_size_ -= bytes; | 339 current_size_ -= bytes; |
| 324 DCHECK_GE(current_size_, 0); | 340 DCHECK_GE(current_size_, 0); |
| 325 } | 341 } |
| 326 | 342 |
| 327 } // namespace disk_cache | 343 } // namespace disk_cache |
| OLD | NEW |