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

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

Issue 1304363013: Add a size estimation mechanism to StoragePartitionHttpCacheDataRemover. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Missed some spots again. Created 5 years, 3 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_entry_impl.h" 5 #include "net/disk_cache/memory/mem_entry_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 Time MemEntryImpl::GetLastModified() const { 176 Time MemEntryImpl::GetLastModified() const {
177 return last_modified_; 177 return last_modified_;
178 } 178 }
179 179
180 int32 MemEntryImpl::GetDataSize(int index) const { 180 int32 MemEntryImpl::GetDataSize(int index) const {
181 if (index < 0 || index >= NUM_STREAMS) 181 if (index < 0 || index >= NUM_STREAMS)
182 return 0; 182 return 0;
183 return data_size_[index]; 183 return data_size_[index];
184 } 184 }
185 185
186 int MemEntryImpl::GetEntrySize() const {
187 int result = 0;
188 for (int i = 0; i < NUM_STREAMS; ++i)
189 result += data_size_[i];
190 return result;
191 }
192
186 int MemEntryImpl::ReadData(int index, int offset, IOBuffer* buf, int buf_len, 193 int MemEntryImpl::ReadData(int index, int offset, IOBuffer* buf, int buf_len,
187 const CompletionCallback& callback) { 194 const CompletionCallback& callback) {
188 if (net_log_.IsCapturing()) { 195 if (net_log_.IsCapturing()) {
189 net_log_.BeginEvent( 196 net_log_.BeginEvent(
190 net::NetLog::TYPE_ENTRY_READ_DATA, 197 net::NetLog::TYPE_ENTRY_READ_DATA,
191 CreateNetLogReadWriteDataCallback(index, offset, buf_len, false)); 198 CreateNetLogReadWriteDataCallback(index, offset, buf_len, false));
192 } 199 }
193 200
194 int result = InternalReadData(index, offset, buf, buf_len); 201 int result = InternalReadData(index, offset, buf, buf_len);
195 202
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
622 scanned_len += kMaxSparseEntrySize - current_child_offset; 629 scanned_len += kMaxSparseEntrySize - current_child_offset;
623 } 630 }
624 return scanned_len; 631 return scanned_len;
625 } 632 }
626 633
627 void MemEntryImpl::DetachChild(int child_id) { 634 void MemEntryImpl::DetachChild(int child_id) {
628 children_->erase(child_id); 635 children_->erase(child_id);
629 } 636 }
630 637
631 } // namespace disk_cache 638 } // namespace disk_cache
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698