OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/memory/mem_backend_impl.h" | 5 #include "net/disk_cache/memory/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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 int MemBackendImpl::DoomEntriesSince(const base::Time initial_time, | 177 int MemBackendImpl::DoomEntriesSince(const base::Time initial_time, |
178 const CompletionCallback& callback) { | 178 const CompletionCallback& callback) { |
179 if (DoomEntriesSince(initial_time)) | 179 if (DoomEntriesSince(initial_time)) |
180 return net::OK; | 180 return net::OK; |
181 | 181 |
182 return net::ERR_FAILED; | 182 return net::ERR_FAILED; |
183 } | 183 } |
184 | 184 |
185 int MemBackendImpl::CalculateSizeOfAllEntries( | 185 int MemBackendImpl::CalculateSizeOfAllEntries( |
186 const CompletionCallback& callback) { | 186 const CompletionCallback& callback) { |
187 return current_size_; | 187 // TODO(msramek): Implement. |
| 188 return net::ERR_NOT_IMPLEMENTED; |
188 } | 189 } |
189 | 190 |
190 class MemBackendImpl::MemIterator : public Backend::Iterator { | 191 class MemBackendImpl::MemIterator : public Backend::Iterator { |
191 public: | 192 public: |
192 explicit MemIterator(base::WeakPtr<MemBackendImpl> backend) | 193 explicit MemIterator(base::WeakPtr<MemBackendImpl> backend) |
193 : backend_(backend), current_(NULL) { | 194 : backend_(backend), current_(NULL) { |
194 } | 195 } |
195 | 196 |
196 int OpenNextEntry(Entry** next_entry, | 197 int OpenNextEntry(Entry** next_entry, |
197 const CompletionCallback& callback) override { | 198 const CompletionCallback& callback) override { |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 if (current_size_ > max_size_) | 343 if (current_size_ > max_size_) |
343 TrimCache(false); | 344 TrimCache(false); |
344 } | 345 } |
345 | 346 |
346 void MemBackendImpl::SubstractStorageSize(int32 bytes) { | 347 void MemBackendImpl::SubstractStorageSize(int32 bytes) { |
347 current_size_ -= bytes; | 348 current_size_ -= bytes; |
348 DCHECK_GE(current_size_, 0); | 349 DCHECK_GE(current_size_, 0); |
349 } | 350 } |
350 | 351 |
351 } // namespace disk_cache | 352 } // namespace disk_cache |
OLD | NEW |