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

doc: improve c++ embedder API doc #55597

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions doc/api/embedding.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ a Node.js-specific environment.

The full code can be found [in the Node.js source tree][embedtest.cc].

### Setting up per-process state
### Setting up a per-process state

Node.js requires some per-process state management in order to run:

Expand Down Expand Up @@ -72,7 +72,7 @@ int main(int argc, char** argv) {
}
```
### Per-instance state
### Setting up a per-instance state
<!-- YAML
changes:
Expand All @@ -86,11 +86,12 @@ Node.js has a concept of a “Node.js instance”, that is commonly being referr
to as `node::Environment`. Each `node::Environment` is associated with:
* Exactly one `v8::Isolate`, i.e. one JS Engine instance,
* Exactly one `uv_loop_t`, i.e. one event loop, and
* A number of `v8::Context`s, but exactly one main `v8::Context`.
* Exactly one `uv_loop_t`, i.e. one event loop,
* A number of `v8::Context`s, but exactly one main `v8::Context`, and
* One `node::IsolateData` instance that contains information that could be
shared by multiple `node::Environment`s that use the same `v8::Isolate`.
Currently, no testing is performed for this scenario.
shared by multiple `node::Environment`s. The embedder should make sure
that `node::IsolateData` is shared only among `node::Environment`s that
use the same `v8::Isolate`, Node.js does not perform this check.
In order to set up a `v8::Isolate`, an `v8::ArrayBuffer::Allocator` needs
to be provided. One possible choice is the default Node.js allocator, which
Expand Down
Loading