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: https://github.com/nodejs/node/pull/27872 Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
This commit is contained in:
parent
6a3d7cffab
commit
2c640bfa46
@ -445,17 +445,6 @@ NodePlatform::ForIsolate(Isolate* isolate) {
|
|||||||
return data;
|
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) {
|
bool NodePlatform::FlushForegroundTasks(Isolate* isolate) {
|
||||||
return ForIsolate(isolate)->FlushForegroundTasksInternal();
|
return ForIsolate(isolate)->FlushForegroundTasksInternal();
|
||||||
}
|
}
|
||||||
|
@ -145,9 +145,14 @@ class NodePlatform : public MultiIsolatePlatform {
|
|||||||
void CallOnWorkerThread(std::unique_ptr<v8::Task> task) override;
|
void CallOnWorkerThread(std::unique_ptr<v8::Task> task) override;
|
||||||
void CallDelayedOnWorkerThread(std::unique_ptr<v8::Task> task,
|
void CallDelayedOnWorkerThread(std::unique_ptr<v8::Task> task,
|
||||||
double delay_in_seconds) override;
|
double delay_in_seconds) override;
|
||||||
void CallOnForegroundThread(v8::Isolate* isolate, v8::Task* task) override;
|
void CallOnForegroundThread(v8::Isolate* isolate, v8::Task* task) override {
|
||||||
void CallDelayedOnForegroundThread(v8::Isolate* isolate, v8::Task* task,
|
UNREACHABLE();
|
||||||
double delay_in_seconds) override;
|
}
|
||||||
|
void CallDelayedOnForegroundThread(v8::Isolate* isolate,
|
||||||
|
v8::Task* task,
|
||||||
|
double delay_in_seconds) override {
|
||||||
|
UNREACHABLE();
|
||||||
|
}
|
||||||
bool IdleTasksEnabled(v8::Isolate* isolate) override;
|
bool IdleTasksEnabled(v8::Isolate* isolate) override;
|
||||||
double MonotonicallyIncreasingTime() override;
|
double MonotonicallyIncreasingTime() override;
|
||||||
double CurrentClockTimeMillis() override;
|
double CurrentClockTimeMillis() override;
|
||||||
|
@ -23,8 +23,10 @@ class RepostingTask : public v8::Task {
|
|||||||
++*run_count_;
|
++*run_count_;
|
||||||
if (repost_count_ > 0) {
|
if (repost_count_ > 0) {
|
||||||
--repost_count_;
|
--repost_count_;
|
||||||
platform_->CallOnForegroundThread(isolate_,
|
std::shared_ptr<v8::TaskRunner> task_runner =
|
||||||
new RepostingTask(repost_count_, run_count_, isolate_, platform_));
|
platform_->GetForegroundTaskRunner(isolate_);
|
||||||
|
task_runner->PostTask(std::make_unique<RepostingTask>(
|
||||||
|
repost_count_, run_count_, isolate_, platform_));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,8 +45,10 @@ TEST_F(PlatformTest, SkipNewTasksInFlushForegroundTasks) {
|
|||||||
const Argv argv;
|
const Argv argv;
|
||||||
Env env {handle_scope, argv};
|
Env env {handle_scope, argv};
|
||||||
int run_count = 0;
|
int run_count = 0;
|
||||||
platform->CallOnForegroundThread(
|
std::shared_ptr<v8::TaskRunner> task_runner =
|
||||||
isolate_, new RepostingTask(2, &run_count, isolate_, platform.get()));
|
platform->GetForegroundTaskRunner(isolate_);
|
||||||
|
task_runner->PostTask(
|
||||||
|
std::make_unique<RepostingTask>(2, &run_count, isolate_, platform.get()));
|
||||||
EXPECT_TRUE(platform->FlushForegroundTasks(isolate_));
|
EXPECT_TRUE(platform->FlushForegroundTasks(isolate_));
|
||||||
EXPECT_EQ(1, run_count);
|
EXPECT_EQ(1, run_count);
|
||||||
EXPECT_TRUE(platform->FlushForegroundTasks(isolate_));
|
EXPECT_TRUE(platform->FlushForegroundTasks(isolate_));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user