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

Commit 49dce0f

Browse files
committed
wait for the external view embedder to be initialized before creating
shell
1 parent f01e2d5 commit 49dce0f

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

shell/platform/fuchsia/flutter/engine.cc

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,14 +123,16 @@ Engine::Engine(Delegate& delegate,
123123
};
124124

125125
// Set up the session connection and other Scenic helpers on the raster
126-
// thread.
126+
// thread. We also need to wait for the external view embedder to be setup
127+
// before creating the shell.
128+
fml::AutoResetWaitableEvent view_embedder_latch;
127129
task_runners.GetRasterTaskRunner()->PostTask(fml::MakeCopyable(
128130
[this, session = std::move(session),
129131
session_error_callback = std::move(session_error_callback),
130132
view_token = std::move(view_token),
131133
view_ref_pair = std::move(view_ref_pair),
132134
max_frames_in_flight = product_config.get_max_frames_in_flight(),
133-
vsync_handle = vsync_event_.get()]() mutable {
135+
vsync_handle = vsync_event_.get(), &view_embedder_latch]() mutable {
134136
session_connection_.emplace(
135137
thread_label_, std::move(session),
136138
std::move(session_error_callback), [](auto) {}, vsync_handle,
@@ -151,7 +153,9 @@ Engine::Engine(Delegate& delegate,
151153
std::move(view_ref_pair), session_connection_.value(),
152154
surface_producer_.value());
153155
}
156+
view_embedder_latch.Signal();
154157
}));
158+
view_embedder_latch.Wait();
155159

156160
// Grab the parent environment services. The platform view may want to
157161
// access some of these services.

shell/platform/fuchsia/flutter/platform_view.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
#include "flutter/fml/macros.h"
1919
#include "flutter/fml/time/time_delta.h"
2020
#include "flutter/shell/common/platform_view.h"
21+
#include "flutter/shell/platform/fuchsia/flutter/fuchsia_external_view_embedder.h"
2122

2223
#include "accessibility_bridge.h"
23-
#include "shell/platform/fuchsia/flutter/fuchsia_external_view_embedder.h"
2424

2525
namespace flutter_runner {
2626

0 commit comments

Comments
 (0)