Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d406785

Browse filesBrowse 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 <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>
1 parent 0d74198 commit d406785
Copy full SHA for d406785

File tree

Expand file treeCollapse file tree

3 files changed

+16
-18
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

3 files changed

+16
-18
lines changed
Open diff view settings
Collapse file

‎src/node_platform.cc‎

Copy file name to clipboardExpand all lines: src/node_platform.cc
-11Lines 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
}
Collapse file

‎src/node_platform.h‎

Copy file name to clipboardExpand all lines: src/node_platform.h
+8-3Lines 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;
Collapse file

‎test/cctest/test_platform.cc‎

Copy file name to clipboardExpand all lines: test/cctest/test_platform.cc
+8-4Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.