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

Unified Diff: net/http/disk_cache_based_quic_server_info.cc

Issue 2807493002: Track STL containers in QuicStreamFactory::DumpMemoryStats (Closed)
Patch Set: address zhongyi@ comment Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/http/disk_cache_based_quic_server_info.h ('k') | net/quic/chromium/properties_based_quic_server_info.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/disk_cache_based_quic_server_info.cc
diff --git a/net/http/disk_cache_based_quic_server_info.cc b/net/http/disk_cache_based_quic_server_info.cc
index 2d4251b497f675dd1442eb769982986490540d69..b149fc95ae211e39a78ef9fa35e31add15508f28 100644
--- a/net/http/disk_cache_based_quic_server_info.cc
+++ b/net/http/disk_cache_based_quic_server_info.cc
@@ -10,6 +10,7 @@
#include "base/logging.h"
#include "base/metrics/histogram_macros.h"
#include "base/stl_util.h"
+#include "base/trace_event/memory_usage_estimator.h"
#include "net/base/completion_callback.h"
#include "net/base/io_buffer.h"
#include "net/base/net_errors.h"
@@ -185,6 +186,15 @@ void DiskCacheBasedQuicServerInfo::OnExternalCacheHit() {
backend_->OnExternalCacheHit(key());
}
+size_t DiskCacheBasedQuicServerInfo::EstimateMemoryUsage() const {
+ return base::trace_event::EstimateMemoryUsage(new_data_) +
+ base::trace_event::EstimateMemoryUsage(pending_write_data_) +
+ base::trace_event::EstimateMemoryUsage(server_id_) +
+ (read_buffer_ == nullptr ? 0 : read_buffer_->size()) +
+ (write_buffer_ == nullptr ? 0 : write_buffer_->size()) +
+ base::trace_event::EstimateMemoryUsage(data_);
+}
+
std::string DiskCacheBasedQuicServerInfo::key() const {
return "quicserverinfo:" + server_id_.ToString();
}
@@ -335,14 +345,14 @@ int DiskCacheBasedQuicServerInfo::DoRead() {
return OK;
}
- read_buffer_ = new IOBuffer(size);
+ read_buffer_ = new IOBufferWithSize(size);
state_ = READ_COMPLETE;
return entry_->ReadData(
0 /* index */, 0 /* offset */, read_buffer_.get(), size, io_callback_);
}
int DiskCacheBasedQuicServerInfo::DoWrite() {
- write_buffer_ = new IOBuffer(new_data_.size());
+ write_buffer_ = new IOBufferWithSize(new_data_.size());
memcpy(write_buffer_->data(), new_data_.data(), new_data_.size());
state_ = WRITE_COMPLETE;
« no previous file with comments | « net/http/disk_cache_based_quic_server_info.h ('k') | net/quic/chromium/properties_based_quic_server_info.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698