Skip to content

Commit d406785

Browse files
committed
src: unimplement deprecated v8-platform methods
This removes the implementations of NodePlatform::CallOnForegroundThread and NodePlatform::CallDelayedOnForegroundThread and updates the test_platform cctest to stop using them. PR-URL: #27872 Reviewed-By: Gus Caplan <[email protected]> Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
1 parent 0d74198 commit d406785

File tree

3 files changed

+16
-18
lines changed

3 files changed

+16
-18
lines changed

src/node_platform.cc

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -445,17 +445,6 @@ NodePlatform::ForIsolate(Isolate* isolate) {
445445
return data;
446446
}
447447

448-
void NodePlatform::CallOnForegroundThread(Isolate* isolate, Task* task) {
449-
ForIsolate(isolate)->PostTask(std::unique_ptr<Task>(task));
450-
}
451-
452-
void NodePlatform::CallDelayedOnForegroundThread(Isolate* isolate,
453-
Task* task,
454-
double delay_in_seconds) {
455-
ForIsolate(isolate)->PostDelayedTask(
456-
std::unique_ptr<Task>(task), delay_in_seconds);
457-
}
458-
459448
bool NodePlatform::FlushForegroundTasks(Isolate* isolate) {
460449
return ForIsolate(isolate)->FlushForegroundTasksInternal();
461450
}

src/node_platform.h

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,14 @@ class NodePlatform : public MultiIsolatePlatform {
145145
void CallOnWorkerThread(std::unique_ptr<v8::Task> task) override;
146146
void CallDelayedOnWorkerThread(std::unique_ptr<v8::Task> task,
147147
double delay_in_seconds) override;
148-
void CallOnForegroundThread(v8::Isolate* isolate, v8::Task* task) override;
149-
void CallDelayedOnForegroundThread(v8::Isolate* isolate, v8::Task* task,
150-
double delay_in_seconds) override;
148+
void CallOnForegroundThread(v8::Isolate* isolate, v8::Task* task) override {
149+
UNREACHABLE();
150+
}
151+
void CallDelayedOnForegroundThread(v8::Isolate* isolate,
152+
v8::Task* task,
153+
double delay_in_seconds) override {
154+
UNREACHABLE();
155+
}
151156
bool IdleTasksEnabled(v8::Isolate* isolate) override;
152157
double MonotonicallyIncreasingTime() override;
153158
double CurrentClockTimeMillis() override;

test/cctest/test_platform.cc

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,10 @@ class RepostingTask : public v8::Task {
2323
++*run_count_;
2424
if (repost_count_ > 0) {
2525
--repost_count_;
26-
platform_->CallOnForegroundThread(isolate_,
27-
new RepostingTask(repost_count_, run_count_, isolate_, platform_));
26+
std::shared_ptr<v8::TaskRunner> task_runner =
27+
platform_->GetForegroundTaskRunner(isolate_);
28+
task_runner->PostTask(std::make_unique<RepostingTask>(
29+
repost_count_, run_count_, isolate_, platform_));
2830
}
2931
}
3032

@@ -43,8 +45,10 @@ TEST_F(PlatformTest, SkipNewTasksInFlushForegroundTasks) {
4345
const Argv argv;
4446
Env env {handle_scope, argv};
4547
int run_count = 0;
46-
platform->CallOnForegroundThread(
47-
isolate_, new RepostingTask(2, &run_count, isolate_, platform.get()));
48+
std::shared_ptr<v8::TaskRunner> task_runner =
49+
platform->GetForegroundTaskRunner(isolate_);
50+
task_runner->PostTask(
51+
std::make_unique<RepostingTask>(2, &run_count, isolate_, platform.get()));
4852
EXPECT_TRUE(platform->FlushForegroundTasks(isolate_));
4953
EXPECT_EQ(1, run_count);
5054
EXPECT_TRUE(platform->FlushForegroundTasks(isolate_));

0 commit comments

Comments
 (0)