Coverage Report

Created: 2026-01-21 08:52

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/node/src/js_native_api_v8_internals.h
Line
Count
Source
1
#ifndef SRC_JS_NATIVE_API_V8_INTERNALS_H_
2
#define SRC_JS_NATIVE_API_V8_INTERNALS_H_
3
4
// The V8 implementation of Node-API, including `js_native_api_v8.h` uses
5
// certain idioms which require definition here. For example, it uses a variant
6
// of persistent references which need not be reset in the constructor. It is
7
// the responsibility of this file to define these idioms. Optionally, this file
8
// may also define `NAPI_VERSION` and set it to the version of Node-API to be
9
// exposed.
10
11
// In the case of the Node.js implementation of Node-API some of the idioms are
12
// imported directly from Node.js by including `node_internals.h` below. Others
13
// are bridged to remove references to the `node` namespace. `node_version.h`,
14
// included below, defines `NAPI_VERSION`.
15
16
#include "node_version.h"
17
18
#include "env.h"
19
#include "gtest/gtest_prod.h"
20
#include "node_errors.h"
21
#include "node_internals.h"
22
23
#define NAPI_ARRAYSIZE(array) node::arraysize((array))
24
25
#define NAPI_FIXED_ONE_BYTE_STRING(isolate, string)                            \
26
  node::FIXED_ONE_BYTE_STRING((isolate), (string))
27
28
#define NAPI_PRIVATE_KEY(context, suffix)                                      \
29
0
  (node::Environment::GetCurrent((context))->napi_##suffix())
30
31
namespace v8impl {
32
33
template <typename T>
34
using Persistent = v8::Global<T>;
35
36
using PersistentToLocal = node::PersistentToLocal;
37
38
[[noreturn]] inline void OnFatalError(const char* location,
39
0
                                      const char* message) {
40
0
  node::OnFatalError(location, message);
41
0
}
42
43
}  // end of namespace v8impl
44
45
#endif  // SRC_JS_NATIVE_API_V8_INTERNALS_H_