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 <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
This commit is contained in:
Anna Henningsen 2019-04-16 11:43:50 +02:00
parent d17dfc7bb1
commit f9da3f0cce
No known key found for this signature in database
GPG Key ID: 9C63F3A6CD2AD8F9
2 changed files with 17 additions and 0 deletions

View File

@ -257,6 +257,16 @@ void PerIsolatePlatformData::PostDelayedTask(
uv_async_send(flush_tasks_);
}
void PerIsolatePlatformData::PostNonNestableTask(std::unique_ptr<Task> task) {
PostTask(std::move(task));
}
void PerIsolatePlatformData::PostNonNestableDelayedTask(
std::unique_ptr<Task> task,
double delay_in_seconds) {
PostDelayedTask(std::move(task), delay_in_seconds);
}
PerIsolatePlatformData::~PerIsolatePlatformData() {
Shutdown();
}

View File

@ -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<v8::Task> task) override;
void PostNonNestableDelayedTask(std::unique_ptr<v8::Task> task,
double delay_in_seconds) override;
void AddShutdownCallback(void (*callback)(void*), void* data);
void Shutdown();