Skip to content

Commit 12f0485

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 3f2c6ce commit 12f0485

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
@@ -254,8 +254,9 @@ void MainThreadInterface::Post(std::unique_ptr<Request> request) {
254254
if (needs_notify) {
255255
CHECK_EQ(0, uv_async_send(&main_thread_request_->first));
256256
if (isolate_ != nullptr && platform_ != nullptr) {
257-
platform_->CallOnForegroundThread(isolate_,
258-
new DispatchMessagesTask(this));
257+
std::shared_ptr<v8::TaskRunner> taskrunner =
258+
platform_->GetForegroundTaskRunner(isolate_);
259+
taskrunner->PostTask(std::make_unique<DispatchMessagesTask>(this));
259260
isolate_->RequestInterrupt([](v8::Isolate* isolate, void* thread) {
260261
static_cast<MainThreadInterface*>(thread)->DispatchMessages();
261262
}, this);

src/inspector_agent.cc

+6-2
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ using v8::Local;
3939
using v8::Message;
4040
using v8::Object;
4141
using v8::String;
42+
using v8::Task;
43+
using v8::TaskRunner;
4244
using v8::Value;
4345

4446
using v8_inspector::StringBuffer;
@@ -49,7 +51,7 @@ using v8_inspector::V8InspectorClient;
4951
static uv_sem_t start_io_thread_semaphore;
5052
static uv_async_t start_io_thread_async;
5153

52-
class StartIoTask : public v8::Task {
54+
class StartIoTask : public Task {
5355
public:
5456
explicit StartIoTask(Agent* agent) : agent(agent) {}
5557

@@ -854,7 +856,9 @@ void Agent::RequestIoThreadStart() {
854856
uv_async_send(&start_io_thread_async);
855857
Isolate* isolate = parent_env_->isolate();
856858
v8::Platform* platform = parent_env_->isolate_data()->platform();
857-
platform->CallOnForegroundThread(isolate, new StartIoTask(this));
859+
std::shared_ptr<TaskRunner> taskrunner =
860+
platform->GetForegroundTaskRunner(isolate);
861+
taskrunner->PostTask(std::make_unique<StartIoTask>(this));
858862
isolate->RequestInterrupt(StartIoInterrupt, this);
859863
uv_async_send(&start_io_thread_async);
860864
}

0 commit comments

Comments
 (0)