Skip to content

Commit

Permalink
src: enable non-nestable V8 platform tasks
Browse files Browse the repository at this point in the history
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: #27252
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
  • Loading branch information
addaleax committed Apr 18, 2019
1 parent d17dfc7 commit f9da3f0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/node_platform.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
7 changes: 7 additions & 0 deletions src/node_platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down

0 comments on commit f9da3f0

Please sign in to comment.