Skip to content

Commit

Permalink
src: move MemoryInfo() for worker code to .cc files
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
addaleax committed Jan 21, 2020
1 parent c78c277 commit 880b47d
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
4 changes: 4 additions & 0 deletions src/node_messaging.cc
Expand Up @@ -900,6 +900,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.
Expand Down
5 changes: 1 addition & 4 deletions src/node_messaging.h
Expand Up @@ -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)

Expand Down
4 changes: 4 additions & 0 deletions src/node_worker.cc
Expand Up @@ -656,6 +656,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
Expand Down
5 changes: 1 addition & 4 deletions src/node_worker.h
Expand Up @@ -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 <typename Fn>
inline bool RequestInterrupt(Fn&& cb);

void MemoryInfo(MemoryTracker* tracker) const override;
SET_MEMORY_INFO_NAME(Worker)
SET_SELF_SIZE(Worker)

Expand Down

0 comments on commit 880b47d

Please sign in to comment.