Skip to content

Commit d5b410e

Browse files
authored
fuchsia: Add scaffolding and basic implementation for flatland migration (flutter#27423)
* fuchsia: Add scaffolding for flatland migration * fuchsia: Add ViewProvider based view creation logic and basic present loop
1 parent 6a49cee commit d5b410e

25 files changed

Lines changed: 1687 additions & 320 deletions

ci/licenses_golden/licenses_flutter

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1399,6 +1399,12 @@ FILE: ../../../flutter/shell/platform/fuchsia/flutter/component.h
13991399
FILE: ../../../flutter/shell/platform/fuchsia/flutter/component_unittest.cc
14001400
FILE: ../../../flutter/shell/platform/fuchsia/flutter/engine.cc
14011401
FILE: ../../../flutter/shell/platform/fuchsia/flutter/engine.h
1402+
FILE: ../../../flutter/shell/platform/fuchsia/flutter/flatland_connection.cc
1403+
FILE: ../../../flutter/shell/platform/fuchsia/flutter/flatland_connection.h
1404+
FILE: ../../../flutter/shell/platform/fuchsia/flutter/flatland_external_view_embedder.cc
1405+
FILE: ../../../flutter/shell/platform/fuchsia/flutter/flatland_external_view_embedder.h
1406+
FILE: ../../../flutter/shell/platform/fuchsia/flutter/flatland_platform_view.cc
1407+
FILE: ../../../flutter/shell/platform/fuchsia/flutter/flatland_platform_view.h
14021408
FILE: ../../../flutter/shell/platform/fuchsia/flutter/flutter_runner_fakes.h
14031409
FILE: ../../../flutter/shell/platform/fuchsia/flutter/flutter_runner_product_configuration.cc
14041410
FILE: ../../../flutter/shell/platform/fuchsia/flutter/flutter_runner_product_configuration.h
@@ -1410,6 +1416,8 @@ FILE: ../../../flutter/shell/platform/fuchsia/flutter/fuchsia_external_view_embe
14101416
FILE: ../../../flutter/shell/platform/fuchsia/flutter/fuchsia_intl.cc
14111417
FILE: ../../../flutter/shell/platform/fuchsia/flutter/fuchsia_intl.h
14121418
FILE: ../../../flutter/shell/platform/fuchsia/flutter/fuchsia_intl_unittest.cc
1419+
FILE: ../../../flutter/shell/platform/fuchsia/flutter/gfx_platform_view.cc
1420+
FILE: ../../../flutter/shell/platform/fuchsia/flutter/gfx_platform_view.h
14131421
FILE: ../../../flutter/shell/platform/fuchsia/flutter/gfx_session_connection.cc
14141422
FILE: ../../../flutter/shell/platform/fuchsia/flutter/gfx_session_connection.h
14151423
FILE: ../../../flutter/shell/platform/fuchsia/flutter/isolate_configurator.cc

shell/platform/fuchsia/flutter/BUILD.gn

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,12 @@ template("runner_sources") {
5959
"component.h",
6060
"engine.cc",
6161
"engine.h",
62+
"flatland_connection.cc",
63+
"flatland_connection.h",
64+
"flatland_external_view_embedder.cc",
65+
"flatland_external_view_embedder.h",
66+
"flatland_platform_view.cc",
67+
"flatland_platform_view.h",
6268
"flutter_runner_product_configuration.cc",
6369
"flutter_runner_product_configuration.h",
6470
"focus_delegate.cc",
@@ -67,6 +73,8 @@ template("runner_sources") {
6773
"fuchsia_external_view_embedder.h",
6874
"fuchsia_intl.cc",
6975
"fuchsia_intl.h",
76+
"gfx_platform_view.cc",
77+
"gfx_platform_view.h",
7078
"gfx_session_connection.cc",
7179
"gfx_session_connection.h",
7280
"isolate_configurator.cc",
@@ -129,6 +137,7 @@ template("runner_sources") {
129137
"$fuchsia_sdk_root/fidl:fuchsia.io",
130138
"$fuchsia_sdk_root/fidl:fuchsia.sys",
131139
"$fuchsia_sdk_root/fidl:fuchsia.ui.app",
140+
"$fuchsia_sdk_root/fidl:fuchsia.ui.composition",
132141
"$fuchsia_sdk_root/fidl:fuchsia.ui.scenic",
133142
"$fuchsia_sdk_root/pkg:async-cpp",
134143
"$fuchsia_sdk_root/pkg:async-default",

shell/platform/fuchsia/flutter/component.cc

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -639,6 +639,29 @@ void Application::CreateViewWithViewRef(
639639
));
640640
}
641641

642+
void Application::CreateView2(fuchsia::ui::app::CreateView2Args view_args) {
643+
if (!svc_) {
644+
FML_DLOG(ERROR)
645+
<< "Component incoming services was invalid when attempting to "
646+
"create a shell for a view provider request.";
647+
return;
648+
}
649+
650+
shell_holders_.emplace(std::make_unique<Engine>(
651+
*this, // delegate
652+
debug_label_, // thread label
653+
svc_, // Component incoming services
654+
runner_incoming_services_, // Runner incoming services
655+
settings_, // settings
656+
std::move(
657+
*view_args.mutable_view_creation_token()), // view creation token
658+
scenic::ViewRefPair::New(), // view ref pair
659+
std::move(fdio_ns_), // FDIO namespace
660+
std::move(directory_request_), // outgoing request
661+
product_config_ // product configuration
662+
));
663+
}
664+
642665
#if !defined(DART_PRODUCT)
643666
void Application::WriteProfileToTrace() const {
644667
for (const auto& engine : shell_holders_) {

shell/platform/fuchsia/flutter/component.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,9 @@ class Application final : public Engine::Delegate,
128128
fuchsia::ui::views::ViewRefControl control_ref,
129129
fuchsia::ui::views::ViewRef view_ref) override;
130130

131+
// |fuchsia::ui::app::ViewProvider|
132+
void CreateView2(fuchsia::ui::app::CreateView2Args view_args) override;
133+
131134
// |flutter::Engine::Delegate|
132135
void OnEngineTerminate(const Engine* holder) override;
133136

0 commit comments

Comments
 (0)