Chromium Code Reviews| 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_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 Loading... | |
| 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 return base::trace_event::EstimateMemoryUsage(data_) + | |
| 258 base::trace_event::EstimateMemoryUsage(key_) + | |
| 259 base::trace_event::EstimateMemoryUsage(children_); | |
|
xunjieli
2017/02/27 18:51:31
I suppose the |children_| entries are accounted fo
jkarlin
2017/02/28 13:10:50
Ah, you're right. Switched to using GetStorageSize
xunjieli
2017/02/28 14:51:23
Ah, sorry for the confusion, the previous patchset
jkarlin
2017/02/28 15:50:54
Done.
| |
| 260 } | |
| 261 | |
| 256 // ------------------------------------------------------------------------ | 262 // ------------------------------------------------------------------------ |
| 257 | 263 |
| 258 MemEntryImpl::MemEntryImpl(MemBackendImpl* backend, | 264 MemEntryImpl::MemEntryImpl(MemBackendImpl* backend, |
| 259 const ::std::string& key, | 265 const ::std::string& key, |
| 260 int child_id, | 266 int child_id, |
| 261 MemEntryImpl* parent, | 267 MemEntryImpl* parent, |
| 262 net::NetLog* net_log) | 268 net::NetLog* net_log) |
| 263 : key_(key), | 269 : key_(key), |
| 264 ref_count_(0), | 270 ref_count_(0), |
| 265 child_id_(child_id), | 271 child_id_(child_id), |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 579 scanned_len += first_pos - current_child_offset; | 585 scanned_len += first_pos - current_child_offset; |
| 580 break; | 586 break; |
| 581 } | 587 } |
| 582 } | 588 } |
| 583 scanned_len += kMaxSparseEntrySize - current_child_offset; | 589 scanned_len += kMaxSparseEntrySize - current_child_offset; |
| 584 } | 590 } |
| 585 return scanned_len; | 591 return scanned_len; |
| 586 } | 592 } |
| 587 | 593 |
| 588 } // namespace disk_cache | 594 } // namespace disk_cache |
| OLD | NEW |