| 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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 } | 145 } |
| 146 | 146 |
| 147 int MemBackendImpl::DoomEntry(const std::string& key, | 147 int MemBackendImpl::DoomEntry(const std::string& key, |
| 148 OldCompletionCallback* callback) { | 148 OldCompletionCallback* callback) { |
| 149 if (DoomEntry(key)) | 149 if (DoomEntry(key)) |
| 150 return net::OK; | 150 return net::OK; |
| 151 | 151 |
| 152 return net::ERR_FAILED; | 152 return net::ERR_FAILED; |
| 153 } | 153 } |
| 154 | 154 |
| 155 int MemBackendImpl::DoomAllEntries(OldCompletionCallback* callback) { | |
| 156 if (DoomAllEntries()) | |
| 157 return net::OK; | |
| 158 | |
| 159 return net::ERR_FAILED; | |
| 160 } | |
| 161 | |
| 162 int MemBackendImpl::DoomAllEntries(const net::CompletionCallback& callback) { | 155 int MemBackendImpl::DoomAllEntries(const net::CompletionCallback& callback) { |
| 163 if (DoomAllEntries()) | 156 if (DoomAllEntries()) |
| 164 return net::OK; | 157 return net::OK; |
| 165 | 158 |
| 166 return net::ERR_FAILED; | 159 return net::ERR_FAILED; |
| 167 } | 160 } |
| 168 | 161 |
| 169 int MemBackendImpl::DoomEntriesBetween(const base::Time initial_time, | |
| 170 const base::Time end_time, | |
| 171 OldCompletionCallback* callback) { | |
| 172 if (DoomEntriesBetween(initial_time, end_time)) | |
| 173 return net::OK; | |
| 174 | |
| 175 return net::ERR_FAILED; | |
| 176 } | |
| 177 | |
| 178 int MemBackendImpl::DoomEntriesBetween( | 162 int MemBackendImpl::DoomEntriesBetween( |
| 179 const base::Time initial_time, const base::Time end_time, | 163 const base::Time initial_time, const base::Time end_time, |
| 180 const net::CompletionCallback& callback) { | 164 const net::CompletionCallback& callback) { |
| 181 if (DoomEntriesBetween(initial_time, end_time)) | 165 if (DoomEntriesBetween(initial_time, end_time)) |
| 182 return net::OK; | 166 return net::OK; |
| 183 | 167 |
| 184 return net::ERR_FAILED; | 168 return net::ERR_FAILED; |
| 185 } | 169 } |
| 186 | 170 |
| 187 int MemBackendImpl::DoomEntriesSince(const base::Time initial_time, | 171 int MemBackendImpl::DoomEntriesSince(const base::Time initial_time, |
| 188 OldCompletionCallback* callback) { | 172 OldCompletionCallback* callback) { |
| 189 if (DoomEntriesSince(initial_time)) | 173 if (DoomEntriesSince(initial_time)) |
| 190 return net::OK; | 174 return net::OK; |
| 191 | 175 |
| 192 return net::ERR_FAILED; | 176 return net::ERR_FAILED; |
| 193 } | 177 } |
| 194 | 178 |
| 195 int MemBackendImpl::OpenNextEntry(void** iter, Entry** next_entry, | 179 int MemBackendImpl::OpenNextEntry(void** iter, Entry** next_entry, |
| 196 OldCompletionCallback* callback) { | |
| 197 if (OpenNextEntry(iter, next_entry)) | |
| 198 return net::OK; | |
| 199 | |
| 200 return net::ERR_FAILED; | |
| 201 } | |
| 202 | |
| 203 int MemBackendImpl::OpenNextEntry(void** iter, Entry** next_entry, | |
| 204 const net::CompletionCallback& callback) { | 180 const net::CompletionCallback& callback) { |
| 205 if (OpenNextEntry(iter, next_entry)) | 181 if (OpenNextEntry(iter, next_entry)) |
| 206 return net::OK; | 182 return net::OK; |
| 207 | 183 |
| 208 return net::ERR_FAILED; | 184 return net::ERR_FAILED; |
| 209 } | 185 } |
| 210 | 186 |
| 211 void MemBackendImpl::EndEnumeration(void** iter) { | 187 void MemBackendImpl::EndEnumeration(void** iter) { |
| 212 *iter = NULL; | 188 *iter = NULL; |
| 213 } | 189 } |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 if (current_size_ > max_size_) | 318 if (current_size_ > max_size_) |
| 343 TrimCache(false); | 319 TrimCache(false); |
| 344 } | 320 } |
| 345 | 321 |
| 346 void MemBackendImpl::SubstractStorageSize(int32 bytes) { | 322 void MemBackendImpl::SubstractStorageSize(int32 bytes) { |
| 347 current_size_ -= bytes; | 323 current_size_ -= bytes; |
| 348 DCHECK_GE(current_size_, 0); | 324 DCHECK_GE(current_size_, 0); |
| 349 } | 325 } |
| 350 | 326 |
| 351 } // namespace disk_cache | 327 } // namespace disk_cache |
| OLD | NEW |