Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 9b95160

Browse filesBrowse files
addaleaxMylesBorins
authored andcommitted
n-api: make per-Context-ness of napi_env explicit
Because instances of `napi_env` are created on a per-global-object basis and because since most N-API functions refer to builtin JS objects, `napi_env` is essentially in 1:1 correspondence with `v8::Context`. This was not clear from the implementation by itself, but has emerged from conversations with the N-API team. This patch changes the `napi_env` implementation to: - Actually store the `v8::Context` it represents. - Provide more direct access to the `node::Environment` to which the `Context` belongs. - Do not store the `uv_loop_t*` explicitly, since it can be inferred from the `node::Environment` and we actually have an N-API method for that. - Replace calls to `isolate->GetCurrentContext()` with the more appropriate `napi_env` `Context`. - Implement a better (although not perfect) way of cleaning up `napi_env` instances. PR-URL: #23689 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Matheus Marchini <mat@mmarchini.me> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
1 parent 98649dc commit 9b95160
Copy full SHA for 9b95160

File tree

Expand file treeCollapse file tree

1 file changed

+86
-98
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+86
-98
lines changed
Open diff view settings

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.