From f56de5a3b43a224bac6de2fee8d2d6c3a1e4a079 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Thu, 16 Jan 2020 19:44:11 +0100 Subject: [PATCH] src: move MemoryInfo() for worker code to .cc files This is a) the right thing to do anyway because these functions can not be inlined by the compiler and b) avoids compilation warnings in the following commit. PR-URL: https://github.com/nodejs/node/pull/31386 Refs: https://github.com/openjs-foundation/summit/pull/240 Reviewed-By: Gireesh Punathil Reviewed-By: James M Snell Reviewed-By: Colin Ihrig Reviewed-By: Rich Trott --- src/node_messaging.cc | 4 ++++ src/node_messaging.h | 5 +---- src/node_worker.cc | 4 ++++ src/node_worker.h | 5 +---- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/node_messaging.cc b/src/node_messaging.cc index 65a40db32826aa..36fd7de1085335 100644 --- a/src/node_messaging.cc +++ b/src/node_messaging.cc @@ -899,6 +899,10 @@ void MessagePort::Entangle(MessagePort* a, MessagePortData* b) { MessagePortData::Entangle(a->data_.get(), b); } +void MessagePort::MemoryInfo(MemoryTracker* tracker) const { + tracker->TrackField("data", data_); +} + Local GetMessagePortConstructorTemplate(Environment* env) { // Factor generating the MessagePort JS constructor into its own piece // of code, because it is needed early on in the child environment setup. diff --git a/src/node_messaging.h b/src/node_messaging.h index 32eedfb34f917b..c10264bb3495ff 100644 --- a/src/node_messaging.h +++ b/src/node_messaging.h @@ -191,10 +191,7 @@ class MessagePort : public HandleWrap { // NULL pointer to the C++ MessagePort object is also detached. inline bool IsDetached() const; - void MemoryInfo(MemoryTracker* tracker) const override { - tracker->TrackField("data", data_); - } - + void MemoryInfo(MemoryTracker* tracker) const override; SET_MEMORY_INFO_NAME(MessagePort) SET_SELF_SIZE(MessagePort) diff --git a/src/node_worker.cc b/src/node_worker.cc index bdc2a8024c97af..0e77f449d78aa7 100644 --- a/src/node_worker.cc +++ b/src/node_worker.cc @@ -655,6 +655,10 @@ void Worker::Exit(int code) { } } +void Worker::MemoryInfo(MemoryTracker* tracker) const { + tracker->TrackField("parent_port", parent_port_); +} + namespace { // Return the MessagePort that is global for this Environment and communicates diff --git a/src/node_worker.h b/src/node_worker.h index 6db7b258ebd81a..f84362f35c1897 100644 --- a/src/node_worker.h +++ b/src/node_worker.h @@ -39,13 +39,10 @@ class Worker : public AsyncWrap { // Wait for the worker thread to stop (in a blocking manner). void JoinThread(); - void MemoryInfo(MemoryTracker* tracker) const override { - tracker->TrackField("parent_port", parent_port_); - } - template inline bool RequestInterrupt(Fn&& cb); + void MemoryInfo(MemoryTracker* tracker) const override; SET_MEMORY_INFO_NAME(Worker) SET_SELF_SIZE(Worker)