summaryrefslogtreecommitdiff
path: root/src/node_http2.h
diff options
context:
space:
mode:
authorAnna Henningsen <anna@addaleax.net>2018-06-10 16:40:13 +0200
committerAnna Henningsen <anna@addaleax.net>2018-07-13 19:53:15 +0200
commit57e301539bff2599974b7269a56377330c9b730e (patch)
tree6f5c866728f22bbacb8dadb89a2c8a12e5b66508 /src/node_http2.h
parent36cc5f5caf52af895079d153a9131fe2b0c6b8f9 (diff)
downloadandroid-node-v8-57e301539bff2599974b7269a56377330c9b730e.tar.gz
android-node-v8-57e301539bff2599974b7269a56377330c9b730e.tar.bz2
android-node-v8-57e301539bff2599974b7269a56377330c9b730e.zip
src: enable more detailed memory tracking
This will enable more detailed heap snapshots based on a newer V8 API. This commit itself is not tied to that API and could be backported. PR-URL: https://github.com/nodejs/node/pull/21742 Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'src/node_http2.h')
-rw-r--r--src/node_http2.h37
1 files changed, 31 insertions, 6 deletions
diff --git a/src/node_http2.h b/src/node_http2.h
index d90c3aed66..cbed2a267d 100644
--- a/src/node_http2.h
+++ b/src/node_http2.h
@@ -83,19 +83,23 @@ enum nghttp2_stream_options {
STREAM_OPTION_GET_TRAILERS = 0x2,
};
-struct nghttp2_stream_write {
+struct nghttp2_stream_write : public MemoryRetainer {
WriteWrap* req_wrap = nullptr;
uv_buf_t buf;
inline explicit nghttp2_stream_write(uv_buf_t buf_) : buf(buf_) {}
inline nghttp2_stream_write(WriteWrap* req, uv_buf_t buf_) :
req_wrap(req), buf(buf_) {}
+
+ void MemoryInfo(MemoryTracker* tracker) const override;
};
-struct nghttp2_header {
+struct nghttp2_header : public MemoryRetainer {
nghttp2_rcbuf* name = nullptr;
nghttp2_rcbuf* value = nullptr;
uint8_t flags = 0;
+
+ void MemoryInfo(MemoryTracker* tracker) const override;
};
@@ -617,7 +621,12 @@ class Http2Stream : public AsyncWrap,
int DoWrite(WriteWrap* w, uv_buf_t* bufs, size_t count,
uv_stream_t* send_handle) override;
- size_t self_size() const override { return sizeof(*this); }
+ void MemoryInfo(MemoryTracker* tracker) const override {
+ tracker->TrackThis(this);
+ tracker->TrackField("current_headers", current_headers_);
+ tracker->TrackField("queue", queue_);
+ }
+
std::string diagnostic_name() const override;
// JavaScript API
@@ -793,7 +802,17 @@ class Http2Session : public AsyncWrap, public StreamListener {
// Write data to the session
ssize_t Write(const uv_buf_t* bufs, size_t nbufs);
- size_t self_size() const override { return sizeof(*this); }
+ void MemoryInfo(MemoryTracker* tracker) const override {
+ tracker->TrackThis(this);
+ tracker->TrackField("streams", streams_);
+ tracker->TrackField("outstanding_pings", outstanding_pings_);
+ tracker->TrackField("outstanding_settings", outstanding_settings_);
+ tracker->TrackField("outgoing_buffers", outgoing_buffers_);
+ tracker->TrackFieldWithSize("outgoing_storage", outgoing_storage_.size());
+ tracker->TrackFieldWithSize("pending_rst_streams",
+ pending_rst_streams_.size() * sizeof(int32_t));
+ }
+
std::string diagnostic_name() const override;
// Schedule an RstStream for after the current write finishes.
@@ -1109,7 +1128,10 @@ class Http2Session::Http2Ping : public AsyncWrap {
public:
explicit Http2Ping(Http2Session* session);
- size_t self_size() const override { return sizeof(*this); }
+ void MemoryInfo(MemoryTracker* tracker) const override {
+ tracker->TrackThis(this);
+ tracker->TrackField("session", session_);
+ }
void Send(uint8_t* payload);
void Done(bool ack, const uint8_t* payload = nullptr);
@@ -1129,7 +1151,10 @@ class Http2Session::Http2Settings : public AsyncWrap {
explicit Http2Settings(Environment* env);
explicit Http2Settings(Http2Session* session);
- size_t self_size() const override { return sizeof(*this); }
+ void MemoryInfo(MemoryTracker* tracker) const override {
+ tracker->TrackThis(this);
+ tracker->TrackField("session", session_);
+ }
void Send();
void Done(bool ack);