diff --git a/src/inspector/main_thread_interface.cc b/src/inspector/main_thread_interface.cc index d3f553caac8f9f..e374c0fd701b3c 100644 --- a/src/inspector/main_thread_interface.cc +++ b/src/inspector/main_thread_interface.cc @@ -254,8 +254,9 @@ void MainThreadInterface::Post(std::unique_ptr request) { if (needs_notify) { CHECK_EQ(0, uv_async_send(&main_thread_request_->first)); if (isolate_ != nullptr && platform_ != nullptr) { - platform_->CallOnForegroundThread(isolate_, - new DispatchMessagesTask(this)); + std::shared_ptr taskrunner = + platform_->GetForegroundTaskRunner(isolate_); + taskrunner->PostTask(std::make_unique(this)); isolate_->RequestInterrupt([](v8::Isolate* isolate, void* thread) { static_cast(thread)->DispatchMessages(); }, this); diff --git a/src/inspector_agent.cc b/src/inspector_agent.cc index f6ceedeb289bac..ae266ba86a4a97 100644 --- a/src/inspector_agent.cc +++ b/src/inspector_agent.cc @@ -39,6 +39,8 @@ using v8::Local; using v8::Message; using v8::Object; using v8::String; +using v8::Task; +using v8::TaskRunner; using v8::Value; using v8_inspector::StringBuffer; @@ -49,7 +51,7 @@ using v8_inspector::V8InspectorClient; static uv_sem_t start_io_thread_semaphore; static uv_async_t start_io_thread_async; -class StartIoTask : public v8::Task { +class StartIoTask : public Task { public: explicit StartIoTask(Agent* agent) : agent(agent) {} @@ -854,7 +856,9 @@ void Agent::RequestIoThreadStart() { uv_async_send(&start_io_thread_async); Isolate* isolate = parent_env_->isolate(); v8::Platform* platform = parent_env_->isolate_data()->platform(); - platform->CallOnForegroundThread(isolate, new StartIoTask(this)); + std::shared_ptr taskrunner = + platform->GetForegroundTaskRunner(isolate); + taskrunner->PostTask(std::make_unique(this)); isolate->RequestInterrupt(StartIoInterrupt, this); uv_async_send(&start_io_thread_async); }