Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
http2: move MemoryInfo impl to cc
Signed-off-by: James M Snell <jasnell@gmail.com>
  • Loading branch information
jasnell committed Apr 16, 2020
commit fe77e2300ec3c515e76a13b7d07993b08ee9ec11
17 changes: 17 additions & 0 deletions src/node_http2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,18 @@ Http2Session::~Http2Session() {
CHECK_EQ(current_nghttp2_memory_, 0);
}

void Http2Session::MemoryInfo(MemoryTracker* tracker) const {
tracker->TrackField("streams", streams_);
tracker->TrackField("outstanding_pings", outstanding_pings_);
tracker->TrackField("outstanding_settings", outstanding_settings_);
tracker->TrackField("outgoing_buffers", outgoing_buffers_);
tracker->TrackFieldWithSize("stream_buf", stream_buf_.len);
tracker->TrackFieldWithSize("outgoing_storage", outgoing_storage_.size());
tracker->TrackFieldWithSize("pending_rst_streams",
pending_rst_streams_.size() * sizeof(int32_t));
tracker->TrackFieldWithSize("nghttp2_memory", current_nghttp2_memory_);
}

std::string Http2Session::diagnostic_name() const {
return std::string("Http2Session ") + TypeName() + " (" +
std::to_string(static_cast<int64_t>(get_async_id())) + ")";
Expand Down Expand Up @@ -1858,6 +1870,11 @@ Http2Stream::~Http2Stream() {
session_->RemoveStream(this);
}

void Http2Stream::MemoryInfo(MemoryTracker* tracker) const {
tracker->TrackField("current_headers", current_headers_);
tracker->TrackField("queue", queue_);
}

std::string Http2Stream::diagnostic_name() const {
return "HttpStream " + std::to_string(id()) + " (" +
std::to_string(static_cast<int64_t>(get_async_id())) + ") [" +
Expand Down
19 changes: 2 additions & 17 deletions src/node_http2.h
Original file line number Diff line number Diff line change
Expand Up @@ -429,11 +429,7 @@ class Http2Stream : public AsyncWrap,
int DoWrite(WriteWrap* w, uv_buf_t* bufs, size_t count,
uv_stream_t* send_handle) override;

void MemoryInfo(MemoryTracker* tracker) const override {
tracker->TrackField("current_headers", current_headers_);
tracker->TrackField("queue", queue_);
}

void MemoryInfo(MemoryTracker* tracker) const override;
SET_MEMORY_INFO_NAME(Http2Stream)
SET_SELF_SIZE(Http2Stream)

Expand Down Expand Up @@ -665,18 +661,7 @@ class Http2Session : public AsyncWrap,
// Write data from stream_buf_ to the session
ssize_t ConsumeHTTP2Data();

void MemoryInfo(MemoryTracker* tracker) const override {
tracker->TrackField("streams", streams_);
tracker->TrackField("outstanding_pings", outstanding_pings_);
tracker->TrackField("outstanding_settings", outstanding_settings_);
tracker->TrackField("outgoing_buffers", outgoing_buffers_);
tracker->TrackFieldWithSize("stream_buf", stream_buf_.len);
tracker->TrackFieldWithSize("outgoing_storage", outgoing_storage_.size());
tracker->TrackFieldWithSize("pending_rst_streams",
pending_rst_streams_.size() * sizeof(int32_t));
tracker->TrackFieldWithSize("nghttp2_memory", current_nghttp2_memory_);
}

void MemoryInfo(MemoryTracker* tracker) const override;
SET_MEMORY_INFO_NAME(Http2Session)
SET_SELF_SIZE(Http2Session)

Expand Down