Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
  • Loading branch information
addaleax committed Apr 16, 2019
commit 3517a3f1fd3e2d976986353766bfce253d3d4973
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