summaryrefslogtreecommitdiff
path: root/src/node_http2.h
diff options
context:
space:
mode:
authorJoyee Cheung <joyeec9h3@gmail.com>2018-09-23 17:52:09 -0400
committerJoyee Cheung <joyeec9h3@gmail.com>2018-10-04 15:32:30 +0200
commit92fa0fcdb76e2b6cb0040eede97fe3c167c31897 (patch)
tree5016ac6cbf7e5873421788387a5b2e011c31ac56 /src/node_http2.h
parentc0c58d5660aeea93c492877894f66dd55771be2e (diff)
downloadandroid-node-v8-92fa0fcdb76e2b6cb0040eede97fe3c167c31897.tar.gz
android-node-v8-92fa0fcdb76e2b6cb0040eede97fe3c167c31897.tar.bz2
android-node-v8-92fa0fcdb76e2b6cb0040eede97fe3c167c31897.zip
src: name EmbededderGraph edges and use class names for nodes
This patch: - Refactors the `MemoryRetainer` API so that the impementer no longer calls `TrackThis()` that sets the size of node on the top of the stack, which may be hard to understand. Instead now they implements `SelfSize()` to provide their self sizes. Also documents the API in the header. - Refactors `MemoryTracker` so it calls `MemoryInfoName()` and `SelfSize()` of `MemoryRetainer` to retrieve info about them, and separate `node_names` and `edge_names` so the edges can be properly named with reference names and the nodes can be named with class names. (Previously the nodes are named with reference names while the edges are all indexed and appear as array elements). - Adds `SET_MEMORY_INFO_NAME()`, `SET_SELF_SIZE()` and `SET_NO_MEMORY_INFO()` convenience macros - Fixes a few `MemoryInfo` calls in some `MemoryRetainers` to track their references properly. - Refactors the heapdump tests to check both node names and edge names, distinguishing between wrapped JS nodes (without prefixes) and embedder wrappers (prefixed with `Node / `). PR-URL: https://github.com/nodejs/node/pull/23072 Reviewed-By: Anna Henningsen <anna@addaleax.net>
Diffstat (limited to 'src/node_http2.h')
-rw-r--r--src/node_http2.h20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/node_http2.h b/src/node_http2.h
index 7fa230979a..2ab452bf02 100644
--- a/src/node_http2.h
+++ b/src/node_http2.h
@@ -92,6 +92,8 @@ struct nghttp2_stream_write : public MemoryRetainer {
req_wrap(req), buf(buf_) {}
void MemoryInfo(MemoryTracker* tracker) const override;
+ SET_MEMORY_INFO_NAME(nghttp2_stream_write)
+ SET_SELF_SIZE(nghttp2_stream_write)
};
struct nghttp2_header : public MemoryRetainer {
@@ -100,6 +102,8 @@ struct nghttp2_header : public MemoryRetainer {
uint8_t flags = 0;
void MemoryInfo(MemoryTracker* tracker) const override;
+ SET_MEMORY_INFO_NAME(nghttp2_header)
+ SET_SELF_SIZE(nghttp2_header)
};
@@ -570,12 +574,12 @@ class Http2Stream : public AsyncWrap,
uv_stream_t* send_handle) override;
void MemoryInfo(MemoryTracker* tracker) const override {
- tracker->TrackThis(this);
tracker->TrackField("current_headers", current_headers_);
tracker->TrackField("queue", queue_);
}
- ADD_MEMORY_INFO_NAME(Http2Stream)
+ SET_MEMORY_INFO_NAME(Http2Stream)
+ SET_SELF_SIZE(Http2Stream)
std::string diagnostic_name() const override;
@@ -755,7 +759,6 @@ class Http2Session : public AsyncWrap, public StreamListener {
ssize_t Write(const uv_buf_t* bufs, size_t nbufs);
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_);
@@ -765,7 +768,8 @@ class Http2Session : public AsyncWrap, public StreamListener {
pending_rst_streams_.size() * sizeof(int32_t));
}
- ADD_MEMORY_INFO_NAME(Http2Session)
+ SET_MEMORY_INFO_NAME(Http2Session)
+ SET_SELF_SIZE(Http2Session)
std::string diagnostic_name() const override;
@@ -1085,11 +1089,11 @@ class Http2Session::Http2Ping : public AsyncWrap {
explicit Http2Ping(Http2Session* session);
void MemoryInfo(MemoryTracker* tracker) const override {
- tracker->TrackThis(this);
tracker->TrackField("session", session_);
}
- ADD_MEMORY_INFO_NAME(Http2Ping)
+ SET_MEMORY_INFO_NAME(Http2Ping)
+ SET_SELF_SIZE(Http2Ping)
void Send(uint8_t* payload);
void Done(bool ack, const uint8_t* payload = nullptr);
@@ -1110,11 +1114,11 @@ class Http2Session::Http2Settings : public AsyncWrap {
explicit Http2Settings(Http2Session* session);
void MemoryInfo(MemoryTracker* tracker) const override {
- tracker->TrackThis(this);
tracker->TrackField("session", session_);
}
- ADD_MEMORY_INFO_NAME(Http2Settings)
+ SET_MEMORY_INFO_NAME(Http2Settings)
+ SET_SELF_SIZE(Http2Settings)
void Send();
void Done(bool ack);