diff options
author | Anna Henningsen <anna@addaleax.net> | 2018-06-02 13:13:59 +0200 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2018-06-06 19:43:42 +0200 |
commit | 2e886e9f452e95a4761a3d85540ba561538b4438 (patch) | |
tree | 86cab682db79fdab45d7688aa1ff40b95f6cf0e3 /src/env.h | |
parent | 5c4d2e60b500a3d093de54b76b17b8f4c52f5da4 (diff) | |
download | android-node-v8-2e886e9f452e95a4761a3d85540ba561538b4438.tar.gz android-node-v8-2e886e9f452e95a4761a3d85540ba561538b4438.tar.bz2 android-node-v8-2e886e9f452e95a4761a3d85540ba561538b4438.zip |
src: make handle onclose property a Symbol
This makes the property “more” hidden when exposing a `HandleWrap`
as public API, e.g. for upcoming `MessagePort`s.
PR-URL: https://github.com/nodejs/node/pull/20876
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Shingo Inoue <leko.noor@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Reviewed-By: John-David Dalton <john.david.dalton@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Diffstat (limited to 'src/env.h')
-rw-r--r-- | src/env.h | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -107,6 +107,11 @@ struct PackageConfig { V(napi_env, "node:napi:env") \ V(napi_wrapper, "node:napi:wrapper") \ +// Symbols are per-isolate primitives but Environment proxies them +// for the sake of convenience. +#define PER_ISOLATE_SYMBOL_PROPERTIES(V) \ + V(handle_onclose_symbol, "handle_onclose") \ + // Strings are per-isolate primitives but Environment proxies them // for the sake of convenience. Strings should be ASCII-only. #define PER_ISOLATE_STRING_PROPERTIES(V) \ @@ -127,7 +132,6 @@ struct PackageConfig { V(chunks_sent_since_last_write_string, "chunksSentSinceLastWrite") \ V(constants_string, "constants") \ V(oncertcb_string, "oncertcb") \ - V(onclose_string, "_onclose") \ V(code_string, "code") \ V(cwd_string, "cwd") \ V(dest_string, "dest") \ @@ -356,10 +360,12 @@ class IsolateData { inline MultiIsolatePlatform* platform() const; #define VP(PropertyName, StringValue) V(v8::Private, PropertyName) +#define VY(PropertyName, StringValue) V(v8::Symbol, PropertyName) #define VS(PropertyName, StringValue) V(v8::String, PropertyName) #define V(TypeName, PropertyName) \ inline v8::Local<TypeName> PropertyName(v8::Isolate* isolate) const; PER_ISOLATE_PRIVATE_SYMBOL_PROPERTIES(VP) + PER_ISOLATE_SYMBOL_PROPERTIES(VY) PER_ISOLATE_STRING_PROPERTIES(VS) #undef V #undef VS @@ -370,10 +376,12 @@ class IsolateData { private: #define VP(PropertyName, StringValue) V(v8::Private, PropertyName) +#define VY(PropertyName, StringValue) V(v8::Symbol, PropertyName) #define VS(PropertyName, StringValue) V(v8::String, PropertyName) #define V(TypeName, PropertyName) \ v8::Eternal<TypeName> PropertyName ## _; PER_ISOLATE_PRIVATE_SYMBOL_PROPERTIES(VP) + PER_ISOLATE_SYMBOL_PROPERTIES(VY) PER_ISOLATE_STRING_PROPERTIES(VS) #undef V #undef VS @@ -737,13 +745,16 @@ class Environment { // Strings and private symbols are shared across shared contexts // The getters simply proxy to the per-isolate primitive. #define VP(PropertyName, StringValue) V(v8::Private, PropertyName) +#define VY(PropertyName, StringValue) V(v8::Symbol, PropertyName) #define VS(PropertyName, StringValue) V(v8::String, PropertyName) #define V(TypeName, PropertyName) \ inline v8::Local<TypeName> PropertyName() const; PER_ISOLATE_PRIVATE_SYMBOL_PROPERTIES(VP) + PER_ISOLATE_SYMBOL_PROPERTIES(VY) PER_ISOLATE_STRING_PROPERTIES(VS) #undef V #undef VS +#undef VY #undef VP #define V(PropertyName, TypeName) \ |