napi: create napi_env as a real structure tied to the isolate#206
napi: create napi_env as a real structure tied to the isolate#206gabrielschulhof wants to merge 3 commits intonodejs:api-prototype-8.xfrom
Conversation
0617d8d to
7fdbdf6
Compare
1. We define struct napi_env__ to include the isolate, the last exception, and the info about the last error. 2. We instantiate one struct napi_env__ during module registration, but only if there isn't one already attached to the isolate, perhaps from the registration of a pervious module. 3. the last exception and the info about the last error are stored in the napi_env__ struct which is associated with the isolate via v8::Isolate::SetData(). Fixes nodejs#198 Closes nodejs#206
|
Looks pretty good and I think we could stash additional persistents in |
7fdbdf6 to
8de9c90
Compare
1. We define struct napi_env__ to include the isolate, the last exception, and the info about the last error. 2. We instantiate one struct napi_env__ during module registration, but only if there isn't one already attached to the isolate, perhaps from the registration of a pervious module. 3. the last exception and the info about the last error are stored in the napi_env__ struct which is associated with the isolate via v8::Isolate::SetData(). Fixes nodejs#198 Closes nodejs#206
|
Also, given @mhdawson's comment at #204 (comment) about not necessarily tying For now, I think we can tie to |
|
OTOH, can we have one
So, if we create the If we go this way, we may end up creating multiple |
|
I've created an alternative implementation using the per-module This assumes of course that, once you expose a function to JS, it will always be called with the same ...
env->isolate = isolate;
cb(env, cbinfo_wrapper);
... |
1. We define struct napi_env__ to include the isolate, the last exception, and the info about the last error. 2. We instantiate one struct napi_env__ during module registration, but only if there isn't one already attached to the isolate, perhaps from the registration of a pervious module. 3. the last exception and the info about the last error are stored in the napi_env__ struct which is associated with the isolate via v8::Isolate::SetData(). Fixes nodejs#198 Closes nodejs#206
8de9c90 to
920ed54
Compare
|
Actually, since we can't really go with |
1. We define struct napi_env__ to include the isolate, the last exception, and the info about the last error. 2. We instantiate one struct napi_env__ during module registration, but only if there isn't one already attached to the isolate, perhaps from the registration of a pervious module. 3. the last exception and the info about the last error are stored in the napi_env__ struct which is associated with the isolate via v8::Isolate::SetData(). Fixes nodejs#198 Closes nodejs#206
920ed54 to
5f0c112
Compare
e5e21c0 to
72a2efb
Compare
|
Can we close this PR? I think #208 is a better solution. |
We define struct napi_env__ to include the isolate, the last
exception, and the info about the last error.
We instantiate one struct napi_env__ during module registration, but
only if there isn't one already attached to the isolate, perhaps from
the registration of a pervious module.
the last exception and the info about the last error are stored in
the napi_env__ struct which is associated with the isolate via
v8::Isolate::SetData().
Fixes #198