Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Side by Side Diff: net/disk_cache/memory/mem_backend_impl.cc

Issue 1398053002: Implement cache counting for the simple and memory backends. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: small changes, cl format Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 // TODO(msramek): Implement. 187 return current_size_;
188 return net::ERR_NOT_IMPLEMENTED;
189 } 188 }
190 189
191 class MemBackendImpl::MemIterator : public Backend::Iterator { 190 class MemBackendImpl::MemIterator : public Backend::Iterator {
192 public: 191 public:
193 explicit MemIterator(base::WeakPtr<MemBackendImpl> backend) 192 explicit MemIterator(base::WeakPtr<MemBackendImpl> backend)
194 : backend_(backend), current_(NULL) { 193 : backend_(backend), current_(NULL) {
195 } 194 }
196 195
197 int OpenNextEntry(Entry** next_entry, 196 int OpenNextEntry(Entry** next_entry,
198 const CompletionCallback& callback) override { 197 const CompletionCallback& callback) override {
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 if (current_size_ > max_size_) 342 if (current_size_ > max_size_)
344 TrimCache(false); 343 TrimCache(false);
345 } 344 }
346 345
347 void MemBackendImpl::SubstractStorageSize(int32 bytes) { 346 void MemBackendImpl::SubstractStorageSize(int32 bytes) {
348 current_size_ -= bytes; 347 current_size_ -= bytes;
349 DCHECK_GE(current_size_, 0); 348 DCHECK_GE(current_size_, 0);
350 } 349 }
351 350
352 } // namespace disk_cache 351 } // namespace disk_cache
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698