Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShelley Vohr <shelley.vohr@gmail.com>2020-10-06 02:16:59 +0300
committerShelley Vohr <shelley.vohr@gmail.com>2020-10-08 04:32:53 +0300
commitccc822c7c8f4a205323231b000b7920d8a04cb26 (patch)
tree2e4521e3cb1570c4c493032e4213c780fcb58769 /src/node_task_queue.cc
parentdae283d96fd31ad0f30840a7e55ac97294f505ac (diff)
src: expose v8::Isolate setup callbacks
PR-URL: https://github.com/nodejs/node/pull/35512 Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Rich Trott <rtrott@gmail.com>
Diffstat (limited to 'src/node_task_queue.cc')
-rw-r--r--src/node_task_queue.cc41
1 files changed, 20 insertions, 21 deletions
diff --git a/src/node_task_queue.cc b/src/node_task_queue.cc
index 0f29fe0a59f..926b27fcf2a 100644
--- a/src/node_task_queue.cc
+++ b/src/node_task_queue.cc
@@ -29,27 +29,6 @@ using v8::PromiseRejectEvent;
using v8::PromiseRejectMessage;
using v8::Value;
-namespace task_queue {
-
-static void EnqueueMicrotask(const FunctionCallbackInfo<Value>& args) {
- Environment* env = Environment::GetCurrent(args);
- Isolate* isolate = env->isolate();
-
- CHECK(args[0]->IsFunction());
-
- isolate->EnqueueMicrotask(args[0].As<Function>());
-}
-
-static void RunMicrotasks(const FunctionCallbackInfo<Value>& args) {
- MicrotasksScope::PerformCheckpoint(args.GetIsolate());
-}
-
-static void SetTickCallback(const FunctionCallbackInfo<Value>& args) {
- Environment* env = Environment::GetCurrent(args);
- CHECK(args[0]->IsFunction());
- env->set_tick_callback_function(args[0].As<Function>());
-}
-
void PromiseRejectCallback(PromiseRejectMessage message) {
static std::atomic<uint64_t> unhandledRejections{0};
static std::atomic<uint64_t> rejectionsHandledAfter{0};
@@ -109,6 +88,26 @@ void PromiseRejectCallback(PromiseRejectMessage message) {
PrintCaughtException(isolate, env->context(), try_catch);
}
}
+namespace task_queue {
+
+static void EnqueueMicrotask(const FunctionCallbackInfo<Value>& args) {
+ Environment* env = Environment::GetCurrent(args);
+ Isolate* isolate = env->isolate();
+
+ CHECK(args[0]->IsFunction());
+
+ isolate->EnqueueMicrotask(args[0].As<Function>());
+}
+
+static void RunMicrotasks(const FunctionCallbackInfo<Value>& args) {
+ MicrotasksScope::PerformCheckpoint(args.GetIsolate());
+}
+
+static void SetTickCallback(const FunctionCallbackInfo<Value>& args) {
+ Environment* env = Environment::GetCurrent(args);
+ CHECK(args[0]->IsFunction());
+ env->set_tick_callback_function(args[0].As<Function>());
+}
static void SetPromiseRejectCallback(
const FunctionCallbackInfo<Value>& args) {