summaryrefslogtreecommitdiff
path: root/test/cctest
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 /test/cctest
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 'test/cctest')
-rw-r--r--test/cctest/test_node_postmortem_metadata.cc18
1 files changed, 9 insertions, 9 deletions
diff --git a/test/cctest/test_node_postmortem_metadata.cc b/test/cctest/test_node_postmortem_metadata.cc
index f0a93f3185..79b766939b 100644
--- a/test/cctest/test_node_postmortem_metadata.cc
+++ b/test/cctest/test_node_postmortem_metadata.cc
@@ -34,9 +34,9 @@ class DebugSymbolsTest : public EnvironmentTestFixture {};
class TestHandleWrap : public node::HandleWrap {
public:
- void MemoryInfo(node::MemoryTracker* tracker) const override {
- tracker->TrackThis(this);
- }
+ SET_NO_MEMORY_INFO()
+ SET_MEMORY_INFO_NAME(TestHandleWrap)
+ SET_SELF_SIZE(TestHandleWrap)
TestHandleWrap(node::Environment* env,
v8::Local<v8::Object> object,
@@ -50,9 +50,9 @@ class TestHandleWrap : public node::HandleWrap {
class TestReqWrap : public node::ReqWrap<uv_req_t> {
public:
- void MemoryInfo(node::MemoryTracker* tracker) const override {
- tracker->TrackThis(this);
- }
+ SET_NO_MEMORY_INFO()
+ SET_MEMORY_INFO_NAME(TestReqWrap)
+ SET_SELF_SIZE(TestReqWrap)
TestReqWrap(node::Environment* env, v8::Local<v8::Object> object)
: node::ReqWrap<uv_req_t>(env,
@@ -76,9 +76,9 @@ class DummyBaseObject : public node::BaseObject {
DummyBaseObject(node::Environment* env, v8::Local<v8::Object> obj) :
BaseObject(env, obj) {}
- void MemoryInfo(node::MemoryTracker* tracker) const override {
- tracker->TrackThis(this);
- }
+ SET_NO_MEMORY_INFO()
+ SET_MEMORY_INFO_NAME(DummyBaseObject)
+ SET_SELF_SIZE(DummyBaseObject)
};
TEST_F(DebugSymbolsTest, BaseObjectPersistentHandle) {