Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit e45d992

Browse files
author
George Wright
committed
Ensure we call into Engine from the UI taskrunner in Shell::EngineHasLivePorts
1 parent a16b0f9 commit e45d992

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

shell/common/shell.cc

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,18 @@ bool Shell::EngineHasLivePorts() const {
462462
if (!engine_) {
463463
return false;
464464
}
465-
return engine_->UIIsolateHasLivePorts();
465+
466+
std::promise<bool> ui_isolate_has_live_ports_promise;
467+
auto ui_isolate_has_live_ports_future = ui_isolate_has_live_ports_promise.get_future();
468+
auto ui_task_runner = task_runners_.GetUITaskRunner();
469+
470+
fml::TaskRunner::RunNowOrPostTask(
471+
ui_task_runner,
472+
[&ui_isolate_has_live_ports_promise, engine = engine_->GetWeakPtr()]() {
473+
ui_isolate_has_live_ports_promise.set_value(engine->UIIsolateHasLivePorts());
474+
});
475+
476+
return ui_isolate_has_live_ports_future.get();
466477
}
467478

468479
bool Shell::IsSetup() const {

0 commit comments

Comments
 (0)