Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
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.
  • Loading branch information
targos committed May 25, 2019
commit 1dab0edebc1ee5a5976f21fbd0f431263c25fe22
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 {
abort();
Comment thread
targos marked this conversation as resolved.
Outdated
}
void CallDelayedOnForegroundThread(v8::Isolate* isolate,
v8::Task* task,
double delay_in_seconds) override {
abort();
}
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