Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

n-api: make per-Context-ness of napi_env explicit #23689

Closed
wants to merge 2 commits into from

Commits on Oct 21, 2018

  1. 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.
    addaleax committed Oct 21, 2018
    Configuration menu
    Copy the full SHA
    3fe948d View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    2f3c078 View commit details
    Browse the repository at this point in the history