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 <gpunathi@in.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
This commit is contained in:
Anna Henningsen authored and Myles Borins committed 2020-04-01 17:37:10 -04:00
1 parent 22bf867149
commit c2176e15ea
4 files changed
+10 -8

No files matched your search

+4
View File
@@ -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<FunctionTemplate> 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.
+1 -4
View File
@@ -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)
+4
View File
@@ -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
+1 -4
View File
@@ -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 <typename Fn>
inline bool RequestInterrupt(Fn&& cb);
void MemoryInfo(MemoryTracker* tracker) const override;
SET_MEMORY_INFO_NAME(Worker)
SET_SELF_SIZE(Worker)