Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

src: unimplement deprecated v8-platform methods #27872

Closed
wants to merge 2 commits into from
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
11 changes: 0 additions & 11 deletions src/node_platform.cc
Original file line number Diff line number Diff line change
Expand Up @@ -445,17 +445,6 @@ NodePlatform::ForIsolate(Isolate* isolate) {
return data;
}

void NodePlatform::CallOnForegroundThread(Isolate* isolate, Task* task) {
ForIsolate(isolate)->PostTask(std::unique_ptr<Task>(task));
}

void NodePlatform::CallDelayedOnForegroundThread(Isolate* isolate,
Task* task,
double delay_in_seconds) {
ForIsolate(isolate)->PostDelayedTask(
std::unique_ptr<Task>(task), delay_in_seconds);
}

bool NodePlatform::FlushForegroundTasks(Isolate* isolate) {
return ForIsolate(isolate)->FlushForegroundTasksInternal();
}
Expand Down
11 changes: 8 additions & 3 deletions src/node_platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,14 @@ class NodePlatform : public MultiIsolatePlatform {
void CallOnWorkerThread(std::unique_ptr<v8::Task> task) override;
void CallDelayedOnWorkerThread(std::unique_ptr<v8::Task> task,
double delay_in_seconds) override;
void CallOnForegroundThread(v8::Isolate* isolate, v8::Task* task) override;
void CallDelayedOnForegroundThread(v8::Isolate* isolate, v8::Task* task,
double delay_in_seconds) override;
void CallOnForegroundThread(v8::Isolate* isolate, v8::Task* task) override {
UNREACHABLE();
}
void CallDelayedOnForegroundThread(v8::Isolate* isolate,
v8::Task* task,
double delay_in_seconds) override {
UNREACHABLE();
}
bool IdleTasksEnabled(v8::Isolate* isolate) override;
double MonotonicallyIncreasingTime() override;
double CurrentClockTimeMillis() override;
Expand Down
12 changes: 8 additions & 4 deletions test/cctest/test_platform.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ class RepostingTask : public v8::Task {
++*run_count_;
if (repost_count_ > 0) {
--repost_count_;
platform_->CallOnForegroundThread(isolate_,
new RepostingTask(repost_count_, run_count_, isolate_, platform_));
std::shared_ptr<v8::TaskRunner> task_runner =
platform_->GetForegroundTaskRunner(isolate_);
task_runner->PostTask(std::make_unique<RepostingTask>(
repost_count_, run_count_, isolate_, platform_));
}
}

Expand All @@ -43,8 +45,10 @@ TEST_F(PlatformTest, SkipNewTasksInFlushForegroundTasks) {
const Argv argv;
Env env {handle_scope, argv};
int run_count = 0;
platform->CallOnForegroundThread(
isolate_, new RepostingTask(2, &run_count, isolate_, platform.get()));
std::shared_ptr<v8::TaskRunner> task_runner =
platform->GetForegroundTaskRunner(isolate_);
task_runner->PostTask(
std::make_unique<RepostingTask>(2, &run_count, isolate_, platform.get()));
EXPECT_TRUE(platform->FlushForegroundTasks(isolate_));
EXPECT_EQ(1, run_count);
EXPECT_TRUE(platform->FlushForegroundTasks(isolate_));
Expand Down