diff --git a/engine/src/flutter/shell/platform/fuchsia/flutter/component.cc b/engine/src/flutter/shell/platform/fuchsia/flutter/component.cc index af2defbdf6..f10f5b6821 100644 --- a/engine/src/flutter/shell/platform/fuchsia/flutter/component.cc +++ b/engine/src/flutter/shell/platform/fuchsia/flutter/component.cc @@ -11,7 +11,6 @@ #include #include #include -#include #include #include #include @@ -554,6 +553,7 @@ void Application::AttemptVMLaunchWithCurrentSettings( FML_CHECK(vm) << "Mut be able to initialize the VM."; } +// |fuchsia::sys::ComponentController| void Application::Kill() { application_controller_.events().OnTerminated( last_return_code_.second, fuchsia::sys::TerminationReason::EXITED); @@ -563,10 +563,12 @@ void Application::Kill() { // collected. } +// |fuchsia::sys::ComponentController| void Application::Detach() { application_controller_.set_error_handler(nullptr); } +// |flutter::Engine::Delegate| void Application::OnEngineTerminate(const Engine* shell_holder) { auto found = std::find_if(shell_holders_.begin(), shell_holders_.end(), [shell_holder](const auto& holder) { @@ -594,20 +596,11 @@ void Application::OnEngineTerminate(const Engine* shell_holder) { } } +// |fuchsia::ui::app::ViewProvider| void Application::CreateView( - zx::eventpair token, - fidl::InterfaceRequest /*incoming_services*/, - fidl::InterfaceHandle< - fuchsia::sys::ServiceProvider> /*outgoing_services*/) { - auto view_ref_pair = scenic::ViewRefPair::New(); - CreateViewWithViewRef(std::move(token), std::move(view_ref_pair.control_ref), - std::move(view_ref_pair.view_ref)); -} - -void Application::CreateViewWithViewRef( zx::eventpair view_token, - fuchsia::ui::views::ViewRefControl control_ref, - fuchsia::ui::views::ViewRef view_ref) { + fidl::InterfaceRequest incoming_services, + fidl::InterfaceHandle outgoing_services) { if (!svc_) { FML_DLOG(ERROR) << "Component incoming services was invalid when attempting to " @@ -623,8 +616,6 @@ void Application::CreateViewWithViewRef( settings_, // settings std::move(isolate_snapshot_), // isolate snapshot scenic::ToViewToken(std::move(view_token)), // view token - std::move(control_ref), // view ref control - std::move(view_ref), // view ref std::move(fdio_ns_), // FDIO namespace std::move(directory_request_), // outgoing request product_config_ // product configuration diff --git a/engine/src/flutter/shell/platform/fuchsia/flutter/component.h b/engine/src/flutter/shell/platform/fuchsia/flutter/component.h index aa0dd1ddf5..af657feeb1 100644 --- a/engine/src/flutter/shell/platform/fuchsia/flutter/component.h +++ b/engine/src/flutter/shell/platform/fuchsia/flutter/component.h @@ -114,16 +114,11 @@ class Application final : public Engine::Delegate, // |fuchsia::ui::app::ViewProvider| void CreateView( - zx::eventpair token, + zx::eventpair view_token, fidl::InterfaceRequest incoming_services, fidl::InterfaceHandle outgoing_services) override; - // |fuchsia::ui::app::ViewProvider| - void CreateViewWithViewRef(zx::eventpair view_token, - fuchsia::ui::views::ViewRefControl control_ref, - fuchsia::ui::views::ViewRef view_ref) override; - // |flutter::Engine::Delegate| void OnEngineTerminate(const Engine* holder) override; diff --git a/engine/src/flutter/shell/platform/fuchsia/flutter/engine.cc b/engine/src/flutter/shell/platform/fuchsia/flutter/engine.cc index 39810f3199..f51823f9ac 100644 --- a/engine/src/flutter/shell/platform/fuchsia/flutter/engine.cc +++ b/engine/src/flutter/shell/platform/fuchsia/flutter/engine.cc @@ -5,6 +5,7 @@ #include "engine.h" #include +#include #include #include @@ -49,19 +50,16 @@ static fml::RefPtr MakeLocalizationPlatformMessage( nullptr); } -Engine::Engine( - Delegate& delegate, - std::string thread_label, - std::shared_ptr svc, - std::shared_ptr runner_services, - flutter::Settings settings, - fml::RefPtr isolate_snapshot, - fuchsia::ui::views::ViewToken view_token, - scenic - : ViewRefPair view_ref_pair, - UniqueFDIONS fdio_ns, - fidl::InterfaceRequest directory_request, - FlutterRunnerProductConfiguration product_config) +Engine::Engine(Delegate& delegate, + std::string thread_label, + std::shared_ptr svc, + std::shared_ptr runner_services, + flutter::Settings settings, + fml::RefPtr isolate_snapshot, + fuchsia::ui::views::ViewToken view_token, + UniqueFDIONS fdio_ns, + fidl::InterfaceRequest directory_request, + FlutterRunnerProductConfiguration product_config) : delegate_(delegate), thread_label_(std::move(thread_label)), settings_(std::move(settings)), @@ -117,14 +115,18 @@ Engine::Engine( }); }; - fuchsia::ui::views::ViewRef platform_view_ref, isolate_view_ref; - view_ref_pair.view_ref.Clone(&platform_view_ref); - view_ref_pair.view_ref.Clone(&isolate_view_ref); + auto view_ref_pair = scenic::ViewRefPair::New(); + fuchsia::ui::views::ViewRef view_ref; + view_ref_pair.view_ref.Clone(&view_ref); + + fuchsia::ui::views::ViewRef dart_view_ref; + view_ref_pair.view_ref.Clone(&dart_view_ref); + zx::eventpair dart_view_ref_event_pair(std::move(dart_view_ref.reference)); // Setup the callback that will instantiate the platform view. flutter::Shell::CreateCallback on_create_platform_view = fml::MakeCopyable( - [debug_label = thread_label_, view_ref = std::move(platform_view_ref), + [debug_label = thread_label_, view_ref = std::move(view_ref), runner_services, parent_environment_service_provider = std::move(parent_environment_service_provider), @@ -261,10 +263,10 @@ Engine::Engine( svc->Connect(environment.NewRequest()); isolate_configurator_ = std::make_unique( - std::move(fdio_ns), // - std::move(environment), // - directory_request.TakeChannel(), // - std::move(isolate_view_ref.reference) // + std::move(fdio_ns), // + std::move(environment), // + directory_request.TakeChannel(), // + std::move(dart_view_ref_event_pair) // ); } diff --git a/engine/src/flutter/shell/platform/fuchsia/flutter/engine.h b/engine/src/flutter/shell/platform/fuchsia/flutter/engine.h index bda6c39dc2..7d211d5f3f 100644 --- a/engine/src/flutter/shell/platform/fuchsia/flutter/engine.h +++ b/engine/src/flutter/shell/platform/fuchsia/flutter/engine.h @@ -11,7 +11,6 @@ #include #include #include -#include #include #include "flutter/fml/macros.h" @@ -38,7 +37,6 @@ class Engine final { flutter::Settings settings, fml::RefPtr isolate_snapshot, fuchsia::ui::views::ViewToken view_token, - scenic::ViewRefPair view_ref_pair, UniqueFDIONS fdio_ns, fidl::InterfaceRequest directory_request, FlutterRunnerProductConfiguration product_config);