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

src: add detailed embedder process initialization API #44121

Merged

Commits on Aug 3, 2022

  1. src: add detailed embedder process initialization API

    So far, process initialization has been a bit all over the place
    in Node.js. `InitializeNodeWithArgs()` is our main public API
    for this, but inclusion of items in it vs. `InitializeOncePerProcess()`
    and `PlatformInit()` has been random at best. Likewise,
    some pieces of initialization have been guarded by
    `NODE_SHARED_MODE`, but also fairly randomly and without
    any meaningful connection to shared library usage.
    
    This leaves embedders in a position to cherry-pick some of
    the initialization code into their own code to make their
    application behave like typical Node.js applications to the
    degree to which they desire it.
    
    Electron takes an alternative route and makes direct use of
    `InitializeOncePerProcess()` already while it is a private
    API, with a `TODO` to add it to the public API in Node.js.
    
    This commit addresses that `TODO`, and `TODO`s around the
    `NODE_SHARED_MODE` usage. Specifically:
    
    - `InitializeOncePerProcess()` and `TearDownOncePerProcess()`
      are added to the public API.
    - The `flags` option of these functions are merged with the
      `flags` option for `InitializeNodeWithArgs()`, since they
      essentially share the same semantics.
    - The return value of the function is made an abstract class,
      rather than a struct, for easier API/ABI stability.
    - Initialization code from `main()` is brought into these
      functions (since that makes sense in general).
    - Add a `TODO` for turning `InitializeNodeWithArgs()` into
      a small wrapper around `InitializeOncePerProcess()` and
      eventually removing it (at least one major release cycle
      each, presumably).
    - Remove `NODE_SHARED_MODE` guards and replace them with
      runtime options.
    addaleax committed Aug 3, 2022
    Copy the full SHA
    16c7a59 View commit details
    Browse the repository at this point in the history
  2. Copy the full SHA
    e3cad18 View commit details
    Browse the repository at this point in the history
  3. Copy the full SHA
    c933415 View commit details
    Browse the repository at this point in the history

Commits on Aug 4, 2022

  1. Copy the full SHA
    46057ce View commit details
    Browse the repository at this point in the history

Commits on Aug 5, 2022

  1. Copy the full SHA
    7973d3d View commit details
    Browse the repository at this point in the history