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

Commit 73c6a4a

Browse files
author
George Wright
authored
Ensure we call into Engine from the UI taskrunner in Shell::EngineHasLivePorts (#13265)
1 parent 39e6901 commit 73c6a4a

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
@@ -468,7 +468,20 @@ bool Shell::EngineHasLivePorts() const {
468468
if (!engine_) {
469469
return false;
470470
}
471-
return engine_->UIIsolateHasLivePorts();
471+
472+
std::promise<bool> ui_isolate_has_live_ports_promise;
473+
auto ui_isolate_has_live_ports_future =
474+
ui_isolate_has_live_ports_promise.get_future();
475+
auto ui_task_runner = task_runners_.GetUITaskRunner();
476+
477+
fml::TaskRunner::RunNowOrPostTask(
478+
ui_task_runner,
479+
[&ui_isolate_has_live_ports_promise, engine = engine_->GetWeakPtr()]() {
480+
ui_isolate_has_live_ports_promise.set_value(
481+
engine->UIIsolateHasLivePorts());
482+
});
483+
484+
return ui_isolate_has_live_ports_future.get();
472485
}
473486

474487
bool Shell::IsSetup() const {

0 commit comments

Comments
 (0)