From 1dab0edebc1ee5a5976f21fbd0f431263c25fe22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= Date: Sat, 25 May 2019 18:07:32 +0200 Subject: [PATCH 1/2] 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. --- src/node_platform.cc | 11 ----------- src/node_platform.h | 11 ++++++++--- test/cctest/test_platform.cc | 12 ++++++++---- 3 files changed, 16 insertions(+), 18 deletions(-) diff --git a/src/node_platform.cc b/src/node_platform.cc index 406146b841e25e..b2e8d77ec7a987 100644 --- a/src/node_platform.cc +++ b/src/node_platform.cc @@ -445,17 +445,6 @@ NodePlatform::ForIsolate(Isolate* isolate) { return data; } -void NodePlatform::CallOnForegroundThread(Isolate* isolate, Task* task) { - ForIsolate(isolate)->PostTask(std::unique_ptr(task)); -} - -void NodePlatform::CallDelayedOnForegroundThread(Isolate* isolate, - Task* task, - double delay_in_seconds) { - ForIsolate(isolate)->PostDelayedTask( - std::unique_ptr(task), delay_in_seconds); -} - bool NodePlatform::FlushForegroundTasks(Isolate* isolate) { return ForIsolate(isolate)->FlushForegroundTasksInternal(); } diff --git a/src/node_platform.h b/src/node_platform.h index 66f86cfa7e74d5..d9f16c3438fd6d 100644 --- a/src/node_platform.h +++ b/src/node_platform.h @@ -145,9 +145,14 @@ class NodePlatform : public MultiIsolatePlatform { void CallOnWorkerThread(std::unique_ptr task) override; void CallDelayedOnWorkerThread(std::unique_ptr 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(); + } + 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; diff --git a/test/cctest/test_platform.cc b/test/cctest/test_platform.cc index 876547480b7032..5420502124d6da 100644 --- a/test/cctest/test_platform.cc +++ b/test/cctest/test_platform.cc @@ -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 task_runner = + platform_->GetForegroundTaskRunner(isolate_); + task_runner->PostTask(std::make_unique( + 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 task_runner = + platform->GetForegroundTaskRunner(isolate_); + task_runner->PostTask( + std::make_unique(2, &run_count, isolate_, platform.get())); EXPECT_TRUE(platform->FlushForegroundTasks(isolate_)); EXPECT_EQ(1, run_count); EXPECT_TRUE(platform->FlushForegroundTasks(isolate_)); From 2f4beed45d7b5c1004e8de60f25898e468d9dc19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= Date: Sat, 25 May 2019 20:11:58 +0200 Subject: [PATCH 2/2] fixup! src: unimplement deprecated v8-platform methods UNREACHABLE --- src/node_platform.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/node_platform.h b/src/node_platform.h index d9f16c3438fd6d..d2eb325c12113e 100644 --- a/src/node_platform.h +++ b/src/node_platform.h @@ -146,12 +146,12 @@ class NodePlatform : public MultiIsolatePlatform { void CallDelayedOnWorkerThread(std::unique_ptr task, double delay_in_seconds) override; void CallOnForegroundThread(v8::Isolate* isolate, v8::Task* task) override { - abort(); + UNREACHABLE(); } void CallDelayedOnForegroundThread(v8::Isolate* isolate, v8::Task* task, double delay_in_seconds) override { - abort(); + UNREACHABLE(); } bool IdleTasksEnabled(v8::Isolate* isolate) override; double MonotonicallyIncreasingTime() override;