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: improve embedder API #30467

Closed
wants to merge 28 commits into from
Closed

src: improve embedder API #30467

wants to merge 28 commits into from

Commits on Mar 12, 2020

  1. src: make FreeEnvironment() perform all necessary cleanup

    Make the calls `stop_sub_worker_contexts()`, `RunCleanup()`
    part of the public API for easier embedding.
    
    (Note that calling `RunAtExit()` is idempotent because the
    at-exit callback queue is cleared after each call.)
    addaleax committed Mar 12, 2020
    Configuration menu
    Copy the full SHA
    b6738bc View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    7e2da59 View commit details
    Browse the repository at this point in the history
  3. src: move worker_context from Environment to IsolateData

    Workers are fully in control of their Isolates, and this helps
    avoid a problem with later changes to `CreateEnvironment()`
    because now we can run the boostrapping code inside the latter.
    addaleax committed Mar 12, 2020
    Configuration menu
    Copy the full SHA
    8a04c59 View commit details
    Browse the repository at this point in the history
  4. src: associate is_main_thread() with worker_context()

    In our codebase, the assumption generally is that `!is_main_thread()`
    means that the current Environment belongs to a Node.js Worker thread.
    addaleax committed Mar 12, 2020
    Configuration menu
    Copy the full SHA
    b732a01 View commit details
    Browse the repository at this point in the history
  5. src: align worker and main thread code with embedder API

    This addresses some long-standing TODOs by Joyee and me about
    making the embedder API more powerful and us less reliant on
    internal APIs for creating the main thread and Workers.
    addaleax committed Mar 12, 2020
    Configuration menu
    Copy the full SHA
    162b9ee View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    2f7cda2 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    eb04cac View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    cf89ff0 View commit details
    Browse the repository at this point in the history
  9. src: provide a variant of LoadEnvironment taking a callback

    This allows embedders to flexibly control how they start JS code
    rather than using `third_party_main`.
    addaleax committed Mar 12, 2020
    Configuration menu
    Copy the full SHA
    7336b7f View commit details
    Browse the repository at this point in the history
  10. src: add LoadEnvironment() variant taking a string

    Allow passing a string as the main module rather than using
    the callback variant.
    addaleax committed Mar 12, 2020
    Configuration menu
    Copy the full SHA
    61098fc View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    541d7f6 View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    c0b957c View commit details
    Browse the repository at this point in the history
  13. src: add unique_ptr equivalent of CreatePlatform

    This makes this bit of the embedder situation a bit easier to use.
    addaleax committed Mar 12, 2020
    Configuration menu
    Copy the full SHA
    9bd88e7 View commit details
    Browse the repository at this point in the history
  14. src: make InitializeNodeWithArgs() official public API

    This is a decent replacement for the to-be-deprecated Init() API.
    addaleax committed Mar 12, 2020
    Configuration menu
    Copy the full SHA
    99912a0 View commit details
    Browse the repository at this point in the history
  15. src: add ability to look up platform based on Environment*

    This should eventually remove any necessity to use the global-state
    `GetMainThreadMultiIsolatePlatform()`.
    addaleax committed Mar 12, 2020
    Configuration menu
    Copy the full SHA
    23b9ace View commit details
    Browse the repository at this point in the history
  16. src: allow non-Node.js TracingControllers

    We do not need a Node.js-provided `v8::TracingController`, generally.
    Loosen that restriction in order to make it easier for embedders
    to provide their own subclass of `v8::TracingController`,
    or none at all.
    
    Refs: electron/electron@9c36576
    addaleax committed Mar 12, 2020
    Configuration menu
    Copy the full SHA
    ededfc9 View commit details
    Browse the repository at this point in the history
  17. src: fix what a dispose without checking

    If created platform with CreatePlatform, the crash occurs because
    it does not check if it was initialized to v8_platform
    when DisposePlatform was called.
    
    Refs: nodejs#31260
    Jichan authored and addaleax committed Mar 12, 2020
    Configuration menu
    Copy the full SHA
    36ec54b View commit details
    Browse the repository at this point in the history
  18. Configuration menu
    Copy the full SHA
    718f91f View commit details
    Browse the repository at this point in the history
  19. src: shutdown platform from FreePlatform()

    There is currently no way to properly do this.
    addaleax committed Mar 12, 2020
    Configuration menu
    Copy the full SHA
    12bb53a View commit details
    Browse the repository at this point in the history
  20. Configuration menu
    Copy the full SHA
    487df31 View commit details
    Browse the repository at this point in the history
  21. Configuration menu
    Copy the full SHA
    799c9b8 View commit details
    Browse the repository at this point in the history
  22. Configuration menu
    Copy the full SHA
    ab5e211 View commit details
    Browse the repository at this point in the history
  23. test: add extended embedder cctest

    Add an embedder cctest that also covers a multi-Environment situation,
    including worker_threads-style inspector support.
    addaleax committed Mar 12, 2020
    Configuration menu
    Copy the full SHA
    682e804 View commit details
    Browse the repository at this point in the history

Commits on Mar 16, 2020

  1. Configuration menu
    Copy the full SHA
    f191a72 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    3ce279a View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    f46c44c View commit details
    Browse the repository at this point in the history

Commits on Mar 17, 2020

  1. squash! test: add extended embedder cctest

    Co-authored-by: Joyee Cheung <joyeec9h3@gmail.com>
    addaleax and joyeecheung committed Mar 17, 2020
    Configuration menu
    Copy the full SHA
    330f4a7 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    634a289 View commit details
    Browse the repository at this point in the history