Skip to content

Commit d760572

Browse files
cjihrigBethGriggs
authored andcommitted
src: remove use of CallOnForegroundThread()
The V8 platform's CallOnForegroundThread() method is deprecated. This commit replaces its use with GetForegroundTaskRunner() functionality instead. PR-URL: #24925 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Franziska Hinkelmann <[email protected]> Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent e050a57 commit d760572

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

src/inspector/main_thread_interface.cc

+3-2
Original file line numberDiff line numberDiff line change
@@ -255,8 +255,9 @@ void MainThreadInterface::Post(std::unique_ptr<Request> request) {
255255
if (needs_notify) {
256256
CHECK_EQ(0, uv_async_send(&main_thread_request_->first));
257257
if (isolate_ != nullptr && platform_ != nullptr) {
258-
platform_->CallOnForegroundThread(isolate_,
259-
new DispatchMessagesTask(this));
258+
std::shared_ptr<v8::TaskRunner> taskrunner =
259+
platform_->GetForegroundTaskRunner(isolate_);
260+
taskrunner->PostTask(std::make_unique<DispatchMessagesTask>(this));
260261
isolate_->RequestInterrupt([](v8::Isolate* isolate, void* thread) {
261262
static_cast<MainThreadInterface*>(thread)->DispatchMessages();
262263
}, this);

src/inspector_agent.cc

+6-2
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ using v8::Local;
4040
using v8::Message;
4141
using v8::Object;
4242
using v8::String;
43+
using v8::Task;
44+
using v8::TaskRunner;
4345
using v8::Value;
4446

4547
using v8_inspector::StringBuffer;
@@ -50,7 +52,7 @@ using v8_inspector::V8InspectorClient;
5052
static uv_sem_t start_io_thread_semaphore;
5153
static uv_async_t start_io_thread_async;
5254

53-
class StartIoTask : public v8::Task {
55+
class StartIoTask : public Task {
5456
public:
5557
explicit StartIoTask(Agent* agent) : agent(agent) {}
5658

@@ -861,7 +863,9 @@ void Agent::RequestIoThreadStart() {
861863
uv_async_send(&start_io_thread_async);
862864
Isolate* isolate = parent_env_->isolate();
863865
v8::Platform* platform = parent_env_->isolate_data()->platform();
864-
platform->CallOnForegroundThread(isolate, new StartIoTask(this));
866+
std::shared_ptr<TaskRunner> taskrunner =
867+
platform->GetForegroundTaskRunner(isolate);
868+
taskrunner->PostTask(std::make_unique<StartIoTask>(this));
865869
isolate->RequestInterrupt(StartIoInterrupt, this);
866870
uv_async_send(&start_io_thread_async);
867871
}

0 commit comments

Comments
 (0)