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

Unified Diff: net/spdy/spdy_framer.cc

Issue 2665283003: Improve memory estimate of SpdySessionPool in net/ MemoryDumpProvider. (Closed)
Patch Set: Address Bence comments Created 3 years, 10 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
Index: net/spdy/spdy_framer.cc
diff --git a/net/spdy/spdy_framer.cc b/net/spdy/spdy_framer.cc
index 89b607aded94d30d3aa8c0b562b9f9acc3041527..37c1181a1649a1e04d5c46cae36cfb20f6c695d4 100644
--- a/net/spdy/spdy_framer.cc
+++ b/net/spdy/spdy_framer.cc
@@ -21,6 +21,7 @@
#include "base/memory/ptr_util.h"
#include "base/metrics/histogram_macros.h"
#include "base/strings/string_util.h"
+#include "base/trace_event/memory_usage_estimator.h"
#include "net/quic/core/quic_flags.h"
#include "net/spdy/hpack/hpack_constants.h"
#include "net/spdy/hpack/hpack_decoder.h"
@@ -562,6 +563,10 @@ void SpdyFramer::CharBuffer::Rewind() {
len_ = 0;
}
+size_t SpdyFramer::CharBuffer::EstimateMemoryUsage() const {
+ return capacity_;
+}
+
SpdyFramer::SpdySettingsScratch::SpdySettingsScratch()
: buffer(8), last_setting_id(-1) {}
@@ -570,6 +575,10 @@ void SpdyFramer::SpdySettingsScratch::Reset() {
last_setting_id = -1;
}
+size_t SpdyFramer::SpdySettingsScratch::EstimateMemoryUsage() const {
+ return base::trace_event::EstimateMemoryUsage(buffer);
+}
+
SpdyFrameType SpdyFramer::ValidateFrameHeader(bool is_control_frame,
int frame_type_field,
size_t payload_length_field) {
@@ -2351,6 +2360,15 @@ void SpdyFramer::SetEncoderHeaderTableDebugVisitor(
GetHpackEncoder()->SetHeaderTableDebugVisitor(std::move(visitor));
}
+size_t SpdyFramer::EstimateMemoryUsage() const {
+ return base::trace_event::EstimateMemoryUsage(current_frame_buffer_) +
+ base::trace_event::EstimateMemoryUsage(settings_scratch_) +
+ base::trace_event::EstimateMemoryUsage(altsvc_scratch_) +
+ base::trace_event::EstimateMemoryUsage(hpack_encoder_) +
+ base::trace_event::EstimateMemoryUsage(hpack_decoder_) +
+ base::trace_event::EstimateMemoryUsage(decoder_adapter_);
+}
+
void SpdyFramer::UpdateHeaderEncoderTableSize(uint32_t value) {
GetHpackEncoder()->ApplyHeaderTableSizeSetting(value);
}

Powered by Google App Engine
This is Rietveld 408576698