Skip to content

Commit

Permalink
src: update GetForegroundTaskRunner override
Browse files Browse the repository at this point in the history
  • Loading branch information
Etienne Pierre-doray authored and nodejs-github-bot committed Sep 18, 2024
1 parent 283a313 commit 8fe6572
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/node_platform.cc
Original file line number Diff line number Diff line change
Expand Up @@ -556,8 +556,8 @@ bool NodePlatform::IdleTasksEnabled(Isolate* isolate) {
return ForIsolate(isolate)->IdleTasksEnabled();
}

std::shared_ptr<v8::TaskRunner>
NodePlatform::GetForegroundTaskRunner(Isolate* isolate) {
std::shared_ptr<v8::TaskRunner> NodePlatform::GetForegroundTaskRunner(
Isolate* isolate, v8::TaskPriority priority) {
return ForIsolate(isolate)->GetForegroundTaskRunner();
}

Expand Down
2 changes: 1 addition & 1 deletion src/node_platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ class NodePlatform : public MultiIsolatePlatform {
void* data) override;

std::shared_ptr<v8::TaskRunner> GetForegroundTaskRunner(
v8::Isolate* isolate) override;
v8::Isolate* isolate, v8::TaskPriority priority) override;

Platform::StackTracePrinter GetStackTracePrinter() override;
v8::PageAllocator* GetPageAllocator() override;
Expand Down
6 changes: 4 additions & 2 deletions test/cctest/test_platform.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ class RepostingTask : public v8::Task {
if (repost_count_ > 0) {
--repost_count_;
std::shared_ptr<v8::TaskRunner> task_runner =
platform_->GetForegroundTaskRunner(isolate_);
platform_->GetForegroundTaskRunner(isolate_,
v8::TaskPriority::kUserBlocking);
task_runner->PostTask(std::make_unique<RepostingTask>(
repost_count_, run_count_, isolate_, platform_));
}
Expand All @@ -46,7 +47,8 @@ TEST_F(PlatformTest, SkipNewTasksInFlushForegroundTasks) {
Env env {handle_scope, argv};
int run_count = 0;
std::shared_ptr<v8::TaskRunner> task_runner =
platform->GetForegroundTaskRunner(isolate_);
platform->GetForegroundTaskRunner(isolate_,
v8::TaskPriority::kUserBlocking);
task_runner->PostTask(
std::make_unique<RepostingTask>(2, &run_count, isolate_, platform.get()));
EXPECT_TRUE(platform->FlushForegroundTasks(isolate_));
Expand Down

0 comments on commit 8fe6572

Please sign in to comment.