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

Commit f572538

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

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

shell/common/shell.cc

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,20 @@ 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 =
468+
ui_isolate_has_live_ports_promise.get_future();
469+
auto ui_task_runner = task_runners_.GetUITaskRunner();
470+
471+
fml::TaskRunner::RunNowOrPostTask(
472+
ui_task_runner,
473+
[&ui_isolate_has_live_ports_promise, engine = engine_->GetWeakPtr()]() {
474+
ui_isolate_has_live_ports_promise.set_value(
475+
engine->UIIsolateHasLivePorts());
476+
});
477+
478+
return ui_isolate_has_live_ports_future.get();
466479
}
467480

468481
bool Shell::IsSetup() const {

0 commit comments

Comments
 (0)