summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/env-inl.h5
-rw-r--r--src/env.h11
2 files changed, 11 insertions, 5 deletions
diff --git a/src/env-inl.h b/src/env-inl.h
index 36f8506baf..9e10cb2414 100644
--- a/src/env-inl.h
+++ b/src/env-inl.h
@@ -1106,10 +1106,13 @@ void AsyncRequest::set_stopped(bool flag) {
inline void Environment::set_ ## PropertyName(v8::Local<TypeName> value) { \
PropertyName ## _.Reset(isolate(), value); \
}
- ENVIRONMENT_STRONG_PERSISTENT_PROPERTIES(V)
+ ENVIRONMENT_STRONG_PERSISTENT_TEMPLATES(V)
ENVIRONMENT_STRONG_PERSISTENT_VALUES(V)
#undef V
+ inline v8::Local<v8::Context> Environment::context() const {
+ return PersistentToLocal::Strong(context_);
+ }
} // namespace node
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
diff --git a/src/env.h b/src/env.h
index 56abe129ab..c9dcdcea6b 100644
--- a/src/env.h
+++ b/src/env.h
@@ -340,11 +340,10 @@ constexpr size_t kFsStatsBufferLength = kFsStatsFieldsNumber * 2;
V(x_forwarded_string, "x-forwarded-for") \
V(zero_return_string, "ZERO_RETURN")
-#define ENVIRONMENT_STRONG_PERSISTENT_PROPERTIES(V) \
+#define ENVIRONMENT_STRONG_PERSISTENT_TEMPLATES(V) \
V(as_callback_data_template, v8::FunctionTemplate) \
V(async_wrap_ctor_template, v8::FunctionTemplate) \
V(async_wrap_object_ctor_template, v8::FunctionTemplate) \
- V(context, v8::Context) \
V(fd_constructor_template, v8::ObjectTemplate) \
V(fdclose_constructor_template, v8::ObjectTemplate) \
V(filehandlereadwrap_template, v8::ObjectTemplate) \
@@ -1061,9 +1060,11 @@ class Environment : public MemoryRetainer {
inline v8::Local<TypeName> PropertyName() const; \
inline void set_ ## PropertyName(v8::Local<TypeName> value);
ENVIRONMENT_STRONG_PERSISTENT_VALUES(V)
- ENVIRONMENT_STRONG_PERSISTENT_PROPERTIES(V)
+ ENVIRONMENT_STRONG_PERSISTENT_TEMPLATES(V)
#undef V
+ inline v8::Local<v8::Context> context() const;
+
#if HAVE_INSPECTOR
inline inspector::Agent* inspector_agent() const {
return inspector_agent_.get();
@@ -1294,8 +1295,10 @@ class Environment : public MemoryRetainer {
#define V(PropertyName, TypeName) v8::Global<TypeName> PropertyName ## _;
ENVIRONMENT_STRONG_PERSISTENT_VALUES(V)
- ENVIRONMENT_STRONG_PERSISTENT_PROPERTIES(V)
+ ENVIRONMENT_STRONG_PERSISTENT_TEMPLATES(V)
#undef V
+
+ v8::Global<v8::Context> context_;
};
} // namespace node