• Home
  • Raw
  • Download

Lines Matching +full:hook +full:- +full:run +full:- +full:in +full:- +full:context

1 #include "env-inl.h"
8 using v8::Context;
19 env->RunAtExitCallbacks(); in RunAtExit()
29 env->AtExit(cb, arg); in AtExit()
35 if (!env->destroy_async_id_list()->empty()) in EmitBeforeExit()
38 HandleScope handle_scope(env->isolate()); in EmitBeforeExit()
39 Context::Scope context_scope(env->context()); in EmitBeforeExit()
42 if (!env->process_object()->Get(env->context(), env->exit_code_string()) in EmitBeforeExit()
46 if (!exit_code_v->ToInteger(env->context()).ToLocal(&exit_code)) return; in EmitBeforeExit()
49 // actually forward empty MaybeLocal<>s (and check env->can_call_into_js()). in EmitBeforeExit()
55 HandleScope handle_scope(env->isolate()); in EmitExit()
56 Context::Scope context_scope(env->context()); in EmitExit()
57 Local<Object> process_object = env->process_object(); in EmitExit()
59 ->Set(env->context(), in EmitExit()
60 FIXED_ONE_BYTE_STRING(env->isolate(), "_exiting"), in EmitExit()
61 True(env->isolate())) in EmitExit()
64 Local<String> exit_code = env->exit_code_string(); in EmitExit()
65 int code = process_object->Get(env->context(), exit_code) in EmitExit()
67 ->Int32Value(env->context()) in EmitExit()
69 ProcessEmit(env, "exit", Integer::New(env->isolate(), code)); in EmitExit()
72 return process_object->Get(env->context(), exit_code) in EmitExit()
74 ->Int32Value(env->context()) in EmitExit()
86 // Use a self-reference to make sure the storage is kept alive while the
87 // cleanup hook is registered but not yet finished.
92 // (but not publicly so for easier ABI/API changes). In particular,
99 // default-initialize AsyncCleanupHookHandle, because in C++ for a
100 // std::unique_ptr to be default-initializable the deleter type also needs
101 // to be default-initializable; in particular, function types don't satisfy
110 env->AddCleanupHook(fun, arg); in AddEnvironmentCleanupHook()
118 env->RemoveCleanupHook(fun, arg); in RemoveEnvironmentCleanupHook()
123 std::shared_ptr<AsyncCleanupHookInfo> keep_alive = info->self; in FinishAsyncCleanupHook()
125 info->env->DecreaseWaitingRequestCounter(); in FinishAsyncCleanupHook()
126 info->self.reset(); in FinishAsyncCleanupHook()
131 info->env->IncreaseWaitingRequestCounter(); in RunAsyncCleanupHook()
132 info->started = true; in RunAsyncCleanupHook()
133 info->fun(info->arg, FinishAsyncCleanupHook, info); in RunAsyncCleanupHook()
143 info->env = env; in AddEnvironmentCleanupHook()
144 info->fun = fun; in AddEnvironmentCleanupHook()
145 info->arg = arg; in AddEnvironmentCleanupHook()
146 info->self = info; in AddEnvironmentCleanupHook()
147 env->AddCleanupHook(RunAsyncCleanupHook, info.get()); in AddEnvironmentCleanupHook()
153 if (handle->info->started) return; in RemoveEnvironmentCleanupHook()
154 handle->info->self.reset(); in RemoveEnvironmentCleanupHook()
155 handle->info->env->RemoveCleanupHook(RunAsyncCleanupHook, handle->info.get()); in RemoveEnvironmentCleanupHook()
160 if (env == nullptr) return -1; in AsyncHooksGetExecutionAsyncId()
161 return env->execution_async_id(); in AsyncHooksGetExecutionAsyncId()
166 if (env == nullptr) return -1; in AsyncHooksGetTriggerAsyncId()
167 return env->trigger_async_id(); in AsyncHooksGetTriggerAsyncId()
190 // Initialize async context struct in EmitAsyncInit()
191 if (trigger_async_id == -1) in EmitAsyncInit()
192 trigger_async_id = env->get_default_trigger_async_id(); in EmitAsyncInit()
194 async_context context = { in EmitAsyncInit() local
195 env->new_async_id(), // async_id_ in EmitAsyncInit()
199 // Run init hooks in EmitAsyncInit()
200 AsyncWrap::EmitAsyncInit(env, resource, name, context.async_id, in EmitAsyncInit()
201 context.trigger_async_id); in EmitAsyncInit()
203 return context; in EmitAsyncInit()