diff options
author | Joyee Cheung <joyeec9h3@gmail.com> | 2018-07-22 04:12:19 +0300 |
---|---|---|
committer | Joyee Cheung <joyeec9h3@gmail.com> | 2018-07-27 10:51:19 +0300 |
commit | 28a3e280eca67f906ae3b47730fe21a389b7bccb (patch) | |
tree | 18a051e45196e6d8a677dd9122470d285e3e34aa /src/cares_wrap.cc | |
parent | 48e5b350b3dd236353e3e8e1196a09f5c5bcda77 (diff) |
src: add proper MemoryInfoName to wrappers
- Use camel case names for memory retainers inherited from AsyncWrap
instead of their provider names (which are all in upper case)
- Assign class names to wraps so that they appear in the heap snapshot
as nodes with class names as node names. Previously some nodes are
named with reference names, which are supposed to be edge names
instead.
PR-URL: https://github.com/nodejs/node/pull/21939
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Diffstat (limited to 'src/cares_wrap.cc')
-rw-r--r-- | src/cares_wrap.cc | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/src/cares_wrap.cc b/src/cares_wrap.cc index 604213a2c65..53d7a724426 100644 --- a/src/cares_wrap.cc +++ b/src/cares_wrap.cc @@ -127,6 +127,7 @@ struct node_ares_task : public MemoryRetainer { uv_poll_t poll_watcher; void MemoryInfo(MemoryTracker* tracker) const override; + ADD_MEMORY_INFO_NAME(node_ares_task) }; struct TaskHash { @@ -173,9 +174,11 @@ class ChannelWrap : public AsyncWrap { tracker->TrackThis(this); if (timer_handle_ != nullptr) tracker->TrackFieldWithSize("timer handle", sizeof(*timer_handle_)); - tracker->TrackField("task list", task_list_); + tracker->TrackField("node_ares_task_list", task_list_); } + ADD_MEMORY_INFO_NAME(ChannelWrap) + static void AresTimeout(uv_timer_t* handle); private: @@ -225,6 +228,8 @@ class GetAddrInfoReqWrap : public ReqWrap<uv_getaddrinfo_t> { tracker->TrackThis(this); } + ADD_MEMORY_INFO_NAME(GetAddrInfoReqWrap) + bool verbatim() const { return verbatim_; } private: @@ -246,6 +251,8 @@ class GetNameInfoReqWrap : public ReqWrap<uv_getnameinfo_t> { void MemoryInfo(MemoryTracker* tracker) const override { tracker->TrackThis(this); } + + ADD_MEMORY_INFO_NAME(GetNameInfoReqWrap) }; GetNameInfoReqWrap::GetNameInfoReqWrap(Environment* env, @@ -1178,6 +1185,8 @@ class QueryAnyWrap: public QueryWrap { tracker->TrackThis(this); } + ADD_MEMORY_INFO_NAME(QueryAnyWrap) + protected: void Parse(unsigned char* buf, int len) override { HandleScope handle_scope(env()->isolate()); @@ -1357,6 +1366,8 @@ class QueryAWrap: public QueryWrap { tracker->TrackThis(this); } + ADD_MEMORY_INFO_NAME(QueryAWrap) + protected: void Parse(unsigned char* buf, int len) override { HandleScope handle_scope(env()->isolate()); @@ -1403,6 +1414,8 @@ class QueryAaaaWrap: public QueryWrap { tracker->TrackThis(this); } + ADD_MEMORY_INFO_NAME(QueryAaaaWrap) + protected: void Parse(unsigned char* buf, int len) override { HandleScope handle_scope(env()->isolate()); @@ -1449,6 +1462,8 @@ class QueryCnameWrap: public QueryWrap { tracker->TrackThis(this); } + ADD_MEMORY_INFO_NAME(QueryCnameWrap) + protected: void Parse(unsigned char* buf, int len) override { HandleScope handle_scope(env()->isolate()); @@ -1482,6 +1497,8 @@ class QueryMxWrap: public QueryWrap { tracker->TrackThis(this); } + ADD_MEMORY_INFO_NAME(QueryMxWrap) + protected: void Parse(unsigned char* buf, int len) override { HandleScope handle_scope(env()->isolate()); @@ -1515,6 +1532,8 @@ class QueryNsWrap: public QueryWrap { tracker->TrackThis(this); } + ADD_MEMORY_INFO_NAME(QueryNsWrap) + protected: void Parse(unsigned char* buf, int len) override { HandleScope handle_scope(env()->isolate()); @@ -1548,6 +1567,8 @@ class QueryTxtWrap: public QueryWrap { tracker->TrackThis(this); } + ADD_MEMORY_INFO_NAME(QueryTxtWrap) + protected: void Parse(unsigned char* buf, int len) override { HandleScope handle_scope(env()->isolate()); @@ -1580,6 +1601,8 @@ class QuerySrvWrap: public QueryWrap { tracker->TrackThis(this); } + ADD_MEMORY_INFO_NAME(QuerySrvWrap) + protected: void Parse(unsigned char* buf, int len) override { HandleScope handle_scope(env()->isolate()); @@ -1611,6 +1634,8 @@ class QueryPtrWrap: public QueryWrap { tracker->TrackThis(this); } + ADD_MEMORY_INFO_NAME(QueryPtrWrap) + protected: void Parse(unsigned char* buf, int len) override { HandleScope handle_scope(env()->isolate()); @@ -1644,6 +1669,8 @@ class QueryNaptrWrap: public QueryWrap { tracker->TrackThis(this); } + ADD_MEMORY_INFO_NAME(QueryNaptrWrap) + protected: void Parse(unsigned char* buf, int len) override { HandleScope handle_scope(env()->isolate()); @@ -1676,6 +1703,8 @@ class QuerySoaWrap: public QueryWrap { tracker->TrackThis(this); } + ADD_MEMORY_INFO_NAME(QuerySoaWrap) + protected: void Parse(unsigned char* buf, int len) override { HandleScope handle_scope(env()->isolate()); @@ -1757,6 +1786,8 @@ class GetHostByAddrWrap: public QueryWrap { tracker->TrackThis(this); } + ADD_MEMORY_INFO_NAME(GetHostByAddrWrap) + protected: void Parse(struct hostent* host) override { HandleScope handle_scope(env()->isolate()); |