Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/env-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -897,7 +897,7 @@ v8::Local<v8::Context> Environment::context() const {
return principal_realm()->context();
}

Realm* Environment::principal_realm() const {
PrincipalRealm* Environment::principal_realm() const {
return principal_realm_.get();
}

Expand Down
2 changes: 1 addition & 1 deletion src/env.h
Original file line number Diff line number Diff line change
Expand Up @@ -886,7 +886,7 @@ class Environment final : public MemoryRetainer {
// Get the context with an explicit realm instead when possible.
// Deprecate soon.
inline v8::Local<v8::Context> context() const;
inline Realm* principal_realm() const;
inline PrincipalRealm* principal_realm() const;

#if HAVE_INSPECTOR
inline inspector::Agent* inspector_agent() const {
Expand Down
5 changes: 5 additions & 0 deletions src/node_realm-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

#include "node_context_data.h"
#include "node_realm.h"
#include "util-inl.h"

namespace node {

Expand Down Expand Up @@ -46,6 +47,10 @@ inline v8::Isolate* Realm::isolate() const {
return isolate_;
}

inline v8::Local<v8::Context> Realm::context() const {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding inline here isn't that important, but it should be applied in node_realm.h, next to virtual.

And since this is a virtual method, I think you'll want to mark the PrincipalRealm and ShadowRealm classes as final as well, otherwise the compiler won't be able to know that there's no subclass which overrides the method (in other words, otherwise the compiler won't know that the method can actually be inlined)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(and make it so Environment::principal_realm() returns a PrincipalRealm* pointer rather than a Realm* pointer – seems compilers can't always see through the cast that currently happens in that method)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done!, thanks I changed commit slug fs to src

return PersistentToLocal::Strong(context_);
}

inline Realm::Kind Realm::kind() const {
return kind_;
}
Expand Down
4 changes: 0 additions & 4 deletions src/node_realm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -295,10 +295,6 @@ void Realm::VerifyNoStrongBaseObjects() {
});
}

v8::Local<v8::Context> Realm::context() const {
return PersistentToLocal::Strong(context_);
}

// Per-realm strong value accessors. The per-realm values should avoid being
// accessed across realms.
#define V(PropertyName, TypeName) \
Expand Down
2 changes: 1 addition & 1 deletion src/node_realm.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ class Realm : public MemoryRetainer {
inline Environment* env() const;
inline v8::Isolate* isolate() const;
inline Kind kind() const;
virtual v8::Local<v8::Context> context() const;
inline virtual v8::Local<v8::Context> context() const;
inline bool has_run_bootstrapping_code() const;

// Methods created using SetMethod(), SetPrototypeMethod(), etc. inside
Expand Down
Loading