mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
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;
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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_));
|
||||
}
|
||||
}
|
||||
|
||||
@ -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_));
|
||||
|
Loading…
Reference in New Issue
Block a user