From f9da3f0cce7188dc9ddbc5c32da550f940ed5f38 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Tue, 16 Apr 2019 11:43:50 +0200 Subject: [PATCH] src: enable non-nestable V8 platform tasks We never execute tasks in a nested fashion, so enabling them should be as simple as forwarding tasks to the existing `Post*` methods. PR-URL: https://github.com/nodejs/node/pull/27252 Reviewed-By: Ben Noordhuis Reviewed-By: James M Snell Reviewed-By: Daniel Bevenius --- src/node_platform.cc | 10 ++++++++++ src/node_platform.h | 7 +++++++ 2 files changed, 17 insertions(+) diff --git a/src/node_platform.cc b/src/node_platform.cc index 47c4373a0f7d6e..8c097c03c7d357 100644 --- a/src/node_platform.cc +++ b/src/node_platform.cc @@ -257,6 +257,16 @@ void PerIsolatePlatformData::PostDelayedTask( uv_async_send(flush_tasks_); } +void PerIsolatePlatformData::PostNonNestableTask(std::unique_ptr task) { + PostTask(std::move(task)); +} + +void PerIsolatePlatformData::PostNonNestableDelayedTask( + std::unique_ptr task, + double delay_in_seconds) { + PostDelayedTask(std::move(task), delay_in_seconds); +} + PerIsolatePlatformData::~PerIsolatePlatformData() { Shutdown(); } diff --git a/src/node_platform.h b/src/node_platform.h index 55a1e806180d34..c3a1fb04fa7ca5 100644 --- a/src/node_platform.h +++ b/src/node_platform.h @@ -64,6 +64,13 @@ class PerIsolatePlatformData : double delay_in_seconds) override; bool IdleTasksEnabled() override { return false; } + // Non-nestable tasks are treated like regular tasks. + bool NonNestableTasksEnabled() const override { return true; } + bool NonNestableDelayedTasksEnabled() const override { return true; } + void PostNonNestableTask(std::unique_ptr task) override; + void PostNonNestableDelayedTask(std::unique_ptr task, + double delay_in_seconds) override; + void AddShutdownCallback(void (*callback)(void*), void* data); void Shutdown();