forked from nodejs/node
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnested_wrap.h
More file actions
33 lines (25 loc) · 810 Bytes
/
nested_wrap.h
File metadata and controls
33 lines (25 loc) · 810 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#ifndef JS_NATIVE_API_6_OBJECT_WRAP_NESTED_WRAP_H_
#define JS_NATIVE_API_6_OBJECT_WRAP_NESTED_WRAP_H_
#include <js_native_api.h>
/**
* Test that an napi_ref can be nested inside another ObjectWrap.
*
* This test shows a critical case where a finalizer deletes an napi_ref
* whose finalizer is also scheduled.
*/
class NestedWrap {
public:
static void Init(napi_env env, napi_value exports);
static void Destructor(node_api_basic_env env,
void* nativeObject,
void* finalize_hint);
private:
explicit NestedWrap();
~NestedWrap();
static napi_value New(napi_env env, napi_callback_info info);
static napi_ref constructor;
napi_env env_;
napi_ref wrapper_;
napi_ref nested_;
};
#endif // JS_NATIVE_API_6_OBJECT_WRAP_NESTED_WRAP_H_