diff options
author | legendecas <legendecas@gmail.com> | 2021-06-08 16:53:07 +0300 |
---|---|---|
committer | legendecas <legendecas@gmail.com> | 2021-07-05 08:55:51 +0300 |
commit | 392213a3873ca702e49a16911b3cb74348b6cbab (patch) | |
tree | 8d78049e003af2bd6919bd6f0f9663f61043bee4 /src/node_api_internals.h | |
parent | 0738a2b7bd011c421b458e586c49f9a7f2657b90 (diff) |
node-api: cctest on v8impl::Reference
PR-URL: https://github.com/nodejs/node/pull/38970
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: Gabriel Schulhof <gabrielschulhof@gmail.com>
Diffstat (limited to 'src/node_api_internals.h')
-rw-r--r-- | src/node_api_internals.h | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/node_api_internals.h b/src/node_api_internals.h new file mode 100644 index 00000000000..318ada38083 --- /dev/null +++ b/src/node_api_internals.h @@ -0,0 +1,30 @@ +#ifndef SRC_NODE_API_INTERNALS_H_ +#define SRC_NODE_API_INTERNALS_H_ + +#include "v8.h" +#define NAPI_EXPERIMENTAL +#include "env-inl.h" +#include "js_native_api_v8.h" +#include "node_api.h" +#include "util-inl.h" + +struct node_napi_env__ : public napi_env__ { + node_napi_env__(v8::Local<v8::Context> context, + const std::string& module_filename); + + bool can_call_into_js() const override; + v8::Maybe<bool> mark_arraybuffer_as_untransferable( + v8::Local<v8::ArrayBuffer> ab) const override; + void CallFinalizer(napi_finalize cb, void* data, void* hint) override; + + inline node::Environment* node_env() const { + return node::Environment::GetCurrent(context()); + } + inline const char* GetFilename() const { return filename.c_str(); } + + std::string filename; +}; + +using node_napi_env = node_napi_env__*; + +#endif // SRC_NODE_API_INTERNALS_H_ |