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

Unified Diff: net/disk_cache/memory/mem_entry_impl.cc

Issue 2556363003: Refactor cache counting into a separate helper class (Closed)
Patch Set: cleanup Created 4 years 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 side-by-side diff with in-line comments
Download patch
Index: net/disk_cache/memory/mem_entry_impl.cc
diff --git a/net/disk_cache/memory/mem_entry_impl.cc b/net/disk_cache/memory/mem_entry_impl.cc
index cfe23e75cf70066caf36a89ec77b05ded1f5af03..1d73aefefd0d377105105b9094a58b12b8e4b32c 100644
--- a/net/disk_cache/memory/mem_entry_impl.cc
+++ b/net/disk_cache/memory/mem_entry_impl.cc
@@ -165,6 +165,14 @@ int32_t MemEntryImpl::GetDataSize(int index) const {
return data_[index].size();
}
+int64_t MemEntryImpl::GetEntrySize() const {
+ int64_t size = key_.size();
+ for (int i = 0; i < kNumStreams; ++i) {
+ size += GetDataSize(i);
+ }
+ return size;
+}
+
int MemEntryImpl::ReadData(int index, int offset, IOBuffer* buf, int buf_len,
const CompletionCallback& callback) {
if (net_log_.IsCapturing()) {

Powered by Google App Engine
This is Rietveld 408576698