Chromium Code Reviews| Index: net/disk_cache/simple/simple_entry_impl.cc |
| diff --git a/net/disk_cache/simple/simple_entry_impl.cc b/net/disk_cache/simple/simple_entry_impl.cc |
| index 23136ba60e541c91b9d5cfccfe0bffb1651df214..a4e4ffd7ede4f75b23aabe89965306e5c6a8c861 100644 |
| --- a/net/disk_cache/simple/simple_entry_impl.cc |
| +++ b/net/disk_cache/simple/simple_entry_impl.cc |
| @@ -20,6 +20,7 @@ |
| #include "base/task_runner_util.h" |
| #include "base/threading/thread_task_runner_handle.h" |
| #include "base/time/time.h" |
| +#include "base/trace_event/memory_usage_estimator.h" |
| #include "net/base/io_buffer.h" |
| #include "net/base/net_errors.h" |
| #include "net/disk_cache/net_log_parameters.h" |
| @@ -149,6 +150,13 @@ using base::FilePath; |
| using base::Time; |
| using base::TaskRunner; |
| +// Static function called by base::trace_event::EstimateMemoryUsage() to |
| +// estimate the memory of SimpleEntryOperation. |
| +// This needs to be in disk_cache namespace. |
| +size_t EstimateMemoryUsage(const SimpleEntryOperation& op) { |
| + return 0; |
| +} |
| + |
| // A helper class to insure that RunNextOperationIfNeeded() is called when |
| // exiting the current stack frame. |
| class SimpleEntryImpl::ScopedOperationRunner { |
| @@ -543,6 +551,12 @@ int SimpleEntryImpl::ReadyForSparseIO(const CompletionCallback& callback) { |
| return net::OK; |
| } |
| +size_t SimpleEntryImpl::EstimateMemoryUsage() const { |
| + return base::trace_event::EstimateMemoryUsage(pending_operations_) + |
| + base::trace_event::EstimateMemoryUsage(executing_operation_) + |
| + (stream_0_data_ ? stream_0_data_->capacity() : 0); |
|
jkarlin
2017/02/21 16:23:29
We're missing synchronous_entry_. That's difficult
xunjieli
2017/02/21 19:44:14
Done. I used sizeof(SimpleSynchronousEntry) becaus
|
| +} |
| + |
| SimpleEntryImpl::~SimpleEntryImpl() { |
| DCHECK(io_thread_checker_.CalledOnValidThread()); |
| DCHECK_EQ(0U, pending_operations_.size()); |