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

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

Issue 2723553002: Keep track of byte usage of the memory cache backend (Closed)
Patch Set: Address comments from PS3 Created 3 years, 9 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
« no previous file with comments | « net/disk_cache/memory/mem_entry_impl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_entry_impl.h" 5 #include "net/disk_cache/memory/mem_entry_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 246
247 bool MemEntryImpl::CouldBeSparse() const { 247 bool MemEntryImpl::CouldBeSparse() const {
248 DCHECK_EQ(PARENT_ENTRY, type()); 248 DCHECK_EQ(PARENT_ENTRY, type());
249 return (children_.get() != nullptr); 249 return (children_.get() != nullptr);
250 } 250 }
251 251
252 int MemEntryImpl::ReadyForSparseIO(const CompletionCallback& callback) { 252 int MemEntryImpl::ReadyForSparseIO(const CompletionCallback& callback) {
253 return net::OK; 253 return net::OK;
254 } 254 }
255 255
256 size_t MemEntryImpl::EstimateMemoryUsage() const {
257 // Subtlety: the entries in children_ are not double counted, as the entry
258 // pointers won't be followed by EstimateMemoryUsage.
259 return base::trace_event::EstimateMemoryUsage(data_) +
260 base::trace_event::EstimateMemoryUsage(key_) +
261 base::trace_event::EstimateMemoryUsage(children_);
262 }
263
256 // ------------------------------------------------------------------------ 264 // ------------------------------------------------------------------------
257 265
258 MemEntryImpl::MemEntryImpl(MemBackendImpl* backend, 266 MemEntryImpl::MemEntryImpl(MemBackendImpl* backend,
259 const ::std::string& key, 267 const ::std::string& key,
260 int child_id, 268 int child_id,
261 MemEntryImpl* parent, 269 MemEntryImpl* parent,
262 net::NetLog* net_log) 270 net::NetLog* net_log)
263 : key_(key), 271 : key_(key),
264 ref_count_(0), 272 ref_count_(0),
265 child_id_(child_id), 273 child_id_(child_id),
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 scanned_len += first_pos - current_child_offset; 587 scanned_len += first_pos - current_child_offset;
580 break; 588 break;
581 } 589 }
582 } 590 }
583 scanned_len += kMaxSparseEntrySize - current_child_offset; 591 scanned_len += kMaxSparseEntrySize - current_child_offset;
584 } 592 }
585 return scanned_len; 593 return scanned_len;
586 } 594 }
587 595
588 } // namespace disk_cache 596 } // namespace disk_cache
OLDNEW
« no previous file with comments | « net/disk_cache/memory/mem_entry_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698