File tree Expand file tree Collapse file tree 2 files changed +16
-6
lines changed
Expand file tree Collapse file tree 2 files changed +16
-6
lines changed Original file line number Diff line number Diff line change @@ -145,7 +145,7 @@ static void RunAsyncCleanupHook(void* arg) {
145145 info->fun (info->arg , FinishAsyncCleanupHook, info);
146146}
147147
148- AsyncCleanupHookHandle AddEnvironmentCleanupHook (
148+ ACHHandle* AddEnvironmentCleanupHookRaw (
149149 Isolate* isolate,
150150 AsyncCleanupHook fun,
151151 void * arg) {
@@ -157,11 +157,11 @@ AsyncCleanupHookHandle AddEnvironmentCleanupHook(
157157 info->arg = arg;
158158 info->self = info;
159159 env->AddCleanupHook (RunAsyncCleanupHook, info.get ());
160- return AsyncCleanupHookHandle ( new ACHHandle { info }) ;
160+ return new ACHHandle { info };
161161}
162162
163- void RemoveEnvironmentCleanupHook (
164- AsyncCleanupHookHandle handle) {
163+ void RemoveEnvironmentCleanupHookRaw (
164+ ACHHandle* handle) {
165165 if (handle->info ->started ) return ;
166166 handle->info ->self .reset ();
167167 handle->info ->env ->RemoveCleanupHook (RunAsyncCleanupHook, handle->info .get ());
Original file line number Diff line number Diff line change @@ -925,12 +925,22 @@ struct ACHHandle;
925925struct NODE_EXTERN DeleteACHHandle { void operator ()(ACHHandle*) const ; };
926926typedef std::unique_ptr<ACHHandle, DeleteACHHandle> AsyncCleanupHookHandle;
927927
928- NODE_EXTERN AsyncCleanupHookHandle AddEnvironmentCleanupHook (
928+ NODE_EXTERN ACHHandle* AddEnvironmentCleanupHookRaw (
929929 v8::Isolate* isolate,
930930 void (*fun)(void * arg, void (*cb)(void *), void* cbarg),
931931 void* arg);
932+ inline AsyncCleanupHookHandle AddEnvironmentCleanupHook (
933+ v8::Isolate* isolate,
934+ void (*fun)(void * arg, void (*cb)(void *), void* cbarg),
935+ void* arg) {
936+ return AsyncCleanupHookHandle (AddEnvironmentCleanupHookRaw (isolate, fun,
937+ arg));
938+ }
932939
933- NODE_EXTERN void RemoveEnvironmentCleanupHook (AsyncCleanupHookHandle holder);
940+ NODE_EXTERN void RemoveEnvironmentCleanupHookRaw (ACHHandle* holder);
941+ inline void RemoveEnvironmentCleanupHook (AsyncCleanupHookHandle holder) {
942+ RemoveEnvironmentCleanupHookRaw (holder.get ());
943+ }
934944
935945/* Returns the id of the current execution context. If the return value is
936946 * zero then no execution has been set. This will happen if the user handles
You can’t perform that action at this time.
0 commit comments