@@ -22,20 +22,6 @@ static void FinalizeExternal(napi_env env, void* data, void* hint) {
22
22
finalize_count ++ ;
23
23
}
24
24
25
- static void FinalizeExternalCallJs (napi_env env , void * data , void * hint ) {
26
- int * actual_value = data ;
27
- NODE_API_ASSERT_RETURN_VOID (env , actual_value == & test_value ,
28
- "The correct pointer was passed to the finalizer" );
29
-
30
- napi_ref finalizer_ref = (napi_ref )hint ;
31
- napi_value js_finalizer ;
32
- napi_value recv ;
33
- NODE_API_CALL_RETURN_VOID (env , napi_get_reference_value (env , finalizer_ref , & js_finalizer ));
34
- NODE_API_CALL_RETURN_VOID (env , napi_get_global (env , & recv ));
35
- NODE_API_CALL_RETURN_VOID (env , napi_call_function (env , recv , js_finalizer , 0 , NULL , NULL ));
36
- NODE_API_CALL_RETURN_VOID (env , napi_delete_reference (env , finalizer_ref ));
37
- }
38
-
39
25
static napi_value CreateExternal (napi_env env , napi_callback_info info ) {
40
26
int * data = & test_value ;
41
27
@@ -118,31 +104,6 @@ CreateExternalWithFinalize(napi_env env, napi_callback_info info) {
118
104
return result ;
119
105
}
120
106
121
- static napi_value
122
- CreateExternalWithJsFinalize (napi_env env , napi_callback_info info ) {
123
- size_t argc = 1 ;
124
- napi_value args [1 ];
125
- NODE_API_CALL (env , napi_get_cb_info (env , info , & argc , args , NULL , NULL ));
126
- NODE_API_ASSERT (env , argc == 1 , "Wrong number of arguments" );
127
- napi_value finalizer = args [0 ];
128
- napi_valuetype finalizer_valuetype ;
129
- NODE_API_CALL (env , napi_typeof (env , finalizer , & finalizer_valuetype ));
130
- NODE_API_ASSERT (env , finalizer_valuetype == napi_function , "Wrong type of first argument" );
131
- napi_ref finalizer_ref ;
132
- NODE_API_CALL (env , napi_create_reference (env , finalizer , 1 , & finalizer_ref ));
133
-
134
- napi_value result ;
135
- NODE_API_CALL (env ,
136
- napi_create_external (env ,
137
- & test_value ,
138
- FinalizeExternalCallJs ,
139
- finalizer_ref , /* finalize_hint */
140
- & result ));
141
-
142
- finalize_count = 0 ;
143
- return result ;
144
- }
145
-
146
107
static napi_value CheckExternal (napi_env env , napi_callback_info info ) {
147
108
size_t argc = 1 ;
148
109
napi_value arg ;
@@ -263,24 +224,24 @@ static napi_value ValidateDeleteBeforeFinalize(napi_env env, napi_callback_info
263
224
EXTERN_C_START
264
225
napi_value Init (napi_env env , napi_value exports ) {
265
226
napi_property_descriptor descriptors [] = {
266
- DECLARE_NODE_API_GETTER ("finalizeCount" , GetFinalizeCount ),
267
- DECLARE_NODE_API_PROPERTY ("createExternal" , CreateExternal ),
268
- DECLARE_NODE_API_PROPERTY ("createExternalWithFinalize" ,
269
- CreateExternalWithFinalize ),
270
- DECLARE_NODE_API_PROPERTY ("createExternalWithJsFinalize" ,
271
- CreateExternalWithJsFinalize ),
272
- DECLARE_NODE_API_PROPERTY ("checkExternal " , CheckExternal ),
273
- DECLARE_NODE_API_PROPERTY ("createReference " , CreateReference ),
274
- DECLARE_NODE_API_PROPERTY ("createSymbol" , CreateSymbol ) ,
275
- DECLARE_NODE_API_PROPERTY ( "createSymbolFor" , CreateSymbolFor ),
276
- DECLARE_NODE_API_PROPERTY ("createSymbolForEmptyString" , CreateSymbolForEmptyString ) ,
277
- DECLARE_NODE_API_PROPERTY ( "createSymbolForIncorrectLength" , CreateSymbolForIncorrectLength ),
278
- DECLARE_NODE_API_PROPERTY ("deleteReference" , DeleteReference ),
279
- DECLARE_NODE_API_PROPERTY ("incrementRefcount" , IncrementRefcount ),
280
- DECLARE_NODE_API_PROPERTY ("decrementRefcount" , DecrementRefcount ),
281
- DECLARE_NODE_API_GETTER ("referenceValue" , GetReferenceValue ),
282
- DECLARE_NODE_API_PROPERTY ("validateDeleteBeforeFinalize" ,
283
- ValidateDeleteBeforeFinalize ),
227
+ DECLARE_NODE_API_GETTER ("finalizeCount" , GetFinalizeCount ),
228
+ DECLARE_NODE_API_PROPERTY ("createExternal" , CreateExternal ),
229
+ DECLARE_NODE_API_PROPERTY ("createExternalWithFinalize" ,
230
+ CreateExternalWithFinalize ),
231
+ DECLARE_NODE_API_PROPERTY ("checkExternal" , CheckExternal ) ,
232
+ DECLARE_NODE_API_PROPERTY ( "createReference" , CreateReference ),
233
+ DECLARE_NODE_API_PROPERTY ("createSymbol " , CreateSymbol ),
234
+ DECLARE_NODE_API_PROPERTY ("createSymbolFor " , CreateSymbolFor ),
235
+ DECLARE_NODE_API_PROPERTY ("createSymbolForEmptyString" ,
236
+ CreateSymbolForEmptyString ),
237
+ DECLARE_NODE_API_PROPERTY ("createSymbolForIncorrectLength" ,
238
+ CreateSymbolForIncorrectLength ),
239
+ DECLARE_NODE_API_PROPERTY ("deleteReference" , DeleteReference ),
240
+ DECLARE_NODE_API_PROPERTY ("incrementRefcount" , IncrementRefcount ),
241
+ DECLARE_NODE_API_PROPERTY ("decrementRefcount" , DecrementRefcount ),
242
+ DECLARE_NODE_API_GETTER ("referenceValue" , GetReferenceValue ),
243
+ DECLARE_NODE_API_PROPERTY ("validateDeleteBeforeFinalize" ,
244
+ ValidateDeleteBeforeFinalize ),
284
245
};
285
246
286
247
NODE_API_CALL (env , napi_define_properties (
0 commit comments