Skip to content

Commit f56de5a

Browse files
addaleaxcodebytere
authored andcommitted
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: #31386 Refs: openjs-foundation/summit#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>
1 parent 0cacc1f commit f56de5a

File tree

4 files changed

+10
-8
lines changed

4 files changed

+10
-8
lines changed

src/node_messaging.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -899,6 +899,10 @@ void MessagePort::Entangle(MessagePort* a, MessagePortData* b) {
899899
MessagePortData::Entangle(a->data_.get(), b);
900900
}
901901

902+
void MessagePort::MemoryInfo(MemoryTracker* tracker) const {
903+
tracker->TrackField("data", data_);
904+
}
905+
902906
Local<FunctionTemplate> GetMessagePortConstructorTemplate(Environment* env) {
903907
// Factor generating the MessagePort JS constructor into its own piece
904908
// of code, because it is needed early on in the child environment setup.

src/node_messaging.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -191,10 +191,7 @@ class MessagePort : public HandleWrap {
191191
// NULL pointer to the C++ MessagePort object is also detached.
192192
inline bool IsDetached() const;
193193

194-
void MemoryInfo(MemoryTracker* tracker) const override {
195-
tracker->TrackField("data", data_);
196-
}
197-
194+
void MemoryInfo(MemoryTracker* tracker) const override;
198195
SET_MEMORY_INFO_NAME(MessagePort)
199196
SET_SELF_SIZE(MessagePort)
200197

src/node_worker.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -655,6 +655,10 @@ void Worker::Exit(int code) {
655655
}
656656
}
657657

658+
void Worker::MemoryInfo(MemoryTracker* tracker) const {
659+
tracker->TrackField("parent_port", parent_port_);
660+
}
661+
658662
namespace {
659663

660664
// Return the MessagePort that is global for this Environment and communicates

src/node_worker.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,10 @@ class Worker : public AsyncWrap {
3939
// Wait for the worker thread to stop (in a blocking manner).
4040
void JoinThread();
4141

42-
void MemoryInfo(MemoryTracker* tracker) const override {
43-
tracker->TrackField("parent_port", parent_port_);
44-
}
45-
4642
template <typename Fn>
4743
inline bool RequestInterrupt(Fn&& cb);
4844

45+
void MemoryInfo(MemoryTracker* tracker) const override;
4946
SET_MEMORY_INFO_NAME(Worker)
5047
SET_SELF_SIZE(Worker)
5148

0 commit comments

Comments
 (0)