From c2176e15ea0897fe01ed7ce277e7feff8837d15b 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. Backport-PR-URL: https://github.com/nodejs/node/pull/32301 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 b51607cc0ee371..f55cb7ed9bd08c 100644 --- a/src/node_messaging.cc +++ b/src/node_messaging.cc @@ -927,6 +927,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 054521b0563c42..d64bf23e086d05 100644 --- a/src/node_messaging.h +++ b/src/node_messaging.h @@ -192,10 +192,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 045fcc74a3a2f6..eeed824f66dee9 100644 --- a/src/node_worker.cc +++ b/src/node_worker.cc @@ -709,6 +709,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 5511e0f1a2eb4a..863e2cffde0f36 100644 --- a/src/node_worker.h +++ b/src/node_worker.h @@ -40,13 +40,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)