Skip to content

Commit f9da3f0

Browse files
committedApr 18, 2019
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: #27252 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Daniel Bevenius <[email protected]>
1 parent d17dfc7 commit f9da3f0

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed
 

‎src/node_platform.cc

+10
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,16 @@ void PerIsolatePlatformData::PostDelayedTask(
257257
uv_async_send(flush_tasks_);
258258
}
259259

260+
void PerIsolatePlatformData::PostNonNestableTask(std::unique_ptr<Task> task) {
261+
PostTask(std::move(task));
262+
}
263+
264+
void PerIsolatePlatformData::PostNonNestableDelayedTask(
265+
std::unique_ptr<Task> task,
266+
double delay_in_seconds) {
267+
PostDelayedTask(std::move(task), delay_in_seconds);
268+
}
269+
260270
PerIsolatePlatformData::~PerIsolatePlatformData() {
261271
Shutdown();
262272
}

‎src/node_platform.h

+7
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,13 @@ class PerIsolatePlatformData :
6464
double delay_in_seconds) override;
6565
bool IdleTasksEnabled() override { return false; }
6666

67+
// Non-nestable tasks are treated like regular tasks.
68+
bool NonNestableTasksEnabled() const override { return true; }
69+
bool NonNestableDelayedTasksEnabled() const override { return true; }
70+
void PostNonNestableTask(std::unique_ptr<v8::Task> task) override;
71+
void PostNonNestableDelayedTask(std::unique_ptr<v8::Task> task,
72+
double delay_in_seconds) override;
73+
6774
void AddShutdownCallback(void (*callback)(void*), void* data);
6875
void Shutdown();
6976

0 commit comments

Comments
 (0)