diff options
author | Anna Henningsen <anna@addaleax.net> | 2020-12-08 13:59:03 +0300 |
---|---|---|
committer | Node.js GitHub Bot <github-bot@iojs.org> | 2020-12-13 18:03:19 +0300 |
commit | d313bf7d471cac082d2122b8aaca6a1cb2b3baab (patch) | |
tree | c2f594222b35e50a8b8aa22e1b45ded83483d10f /src/api | |
parent | 7069d223431a527aa7355d91c55241799057ae87 (diff) |
src: add way to get IsolateData and allocator from Environment
Add a way to get the current `IsolateData*` and, from it, the current
Node.js `ArrayBufferAllocator` if there is one. This can be useful
for re-using either one of these structures as an embedder.
PR-URL: https://github.com/nodejs/node/pull/36441
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Diffstat (limited to 'src/api')
-rw-r--r-- | src/api/environment.cc | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/api/environment.cc b/src/api/environment.cc index 648f0184c35..46e3360ef9c 100644 --- a/src/api/environment.cc +++ b/src/api/environment.cc @@ -438,6 +438,14 @@ Environment* GetCurrentEnvironment(Local<Context> context) { return Environment::GetCurrent(context); } +IsolateData* GetEnvironmentIsolateData(Environment* env) { + return env->isolate_data(); +} + +ArrayBufferAllocator* GetArrayBufferAllocator(IsolateData* isolate_data) { + return isolate_data->node_allocator(); +} + MultiIsolatePlatform* GetMultiIsolatePlatform(Environment* env) { return GetMultiIsolatePlatform(env->isolate_data()); } |