Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 25 additions & 25 deletions shell/platform/fuchsia/flutter/flatland_platform_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -182,43 +182,43 @@ void FlatlandPlatformView::OnCreateView(ViewCallback on_view_created,
FML_CHECK(weak);
FML_CHECK(weak->child_view_info_.count(content_id.value) == 0);

// Bind the child view watcher to the platform thread so that the FIDL calls
// are handled on the platform thread.
fuchsia::ui::composition::ChildViewWatcherPtr child_view_watcher =
child_view_watcher_handle.Bind();
FML_CHECK(child_view_watcher);

child_view_watcher.set_error_handler(
[weak, view_id, content_id](zx_status_t status) {
FML_LOG(WARNING) << "Child disconnected. ChildViewWatcher status: "
<< status;

platform_task_runner->PostTask(fml::MakeCopyable(
[weak, view_id, content_id,
watcher_handle = std::move(child_view_watcher_handle)]() mutable {
if (!weak) {
FML_LOG(WARNING)
<< "Flatland View bound to PlatformView after PlatformView was "
"destroyed; ignoring.";
return;
}

// Disconnected views cannot listen to pointer events.
weak->pointer_injector_delegate_->OnDestroyView(view_id);
// Bind the child view watcher to the platform thread so that the FIDL
// calls are handled on the platform thread.
fuchsia::ui::composition::ChildViewWatcherPtr child_view_watcher =
watcher_handle.Bind();
FML_CHECK(child_view_watcher);

weak->OnChildViewDisconnected(content_id.value);
});

platform_task_runner->PostTask(
fml::MakeCopyable([weak, view_id, content_id,
watcher = std::move(child_view_watcher)]() mutable {
if (!weak) {
child_view_watcher.set_error_handler([weak, view_id, content_id](
zx_status_t status) {
FML_LOG(WARNING)
<< "Flatland View bound to PlatformView after PlatformView was "
"destroyed; ignoring.";
return;
}
<< "Child disconnected. ChildViewWatcher status: " << status;

if (!weak) {
FML_LOG(WARNING) << "Flatland View bound to PlatformView after "
"PlatformView was "
"destroyed; ignoring.";
return;
}

// Disconnected views cannot listen to pointer events.
weak->pointer_injector_delegate_->OnDestroyView(view_id);

weak->OnChildViewDisconnected(content_id.value);
});

weak->child_view_info_.emplace(
std::piecewise_construct, std::forward_as_tuple(content_id.value),
std::forward_as_tuple(view_id, std::move(watcher)));
std::forward_as_tuple(view_id, std::move(child_view_watcher)));

weak->child_view_info_.at(content_id.value)
.child_view_watcher->GetStatus(
Expand Down