From 61b749c7fd07f5a351fc61c5c2ec3c5d587ce0c8 Mon Sep 17 00:00:00 2001 From: David Worsham Date: Mon, 28 Dec 2020 18:16:27 -0800 Subject: [PATCH] fuchsia: Shutdown Dart VM properly (flutter/engine#23243) --- engine/src/flutter/shell/common/shell.cc | 49 +-- engine/src/flutter/shell/common/shell.h | 44 -- .../platform/fuchsia/flutter/component.cc | 410 ++++++++---------- .../platform/fuchsia/flutter/component.h | 4 +- .../shell/platform/fuchsia/flutter/engine.cc | 24 +- .../shell/platform/fuchsia/flutter/engine.h | 3 +- 6 files changed, 210 insertions(+), 324 deletions(-) diff --git a/engine/src/flutter/shell/common/shell.cc b/engine/src/flutter/shell/common/shell.cc index a7a5098920..98d8f43f28 100644 --- a/engine/src/flutter/shell/common/shell.cc +++ b/engine/src/flutter/shell/common/shell.cc @@ -265,53 +265,28 @@ std::unique_ptr Shell::Create( TRACE_EVENT0("flutter", "Shell::Create"); - auto vm = DartVMRef::Create(settings); - FML_CHECK(vm) << "Must be able to initialize the VM."; - - auto vm_data = vm->GetVMData(); - - return Shell::Create(std::move(task_runners), // - std::move(platform_data), // - std::move(settings), // - vm_data->GetIsolateSnapshot(), // isolate snapshot - on_create_platform_view, // - on_create_rasterizer, // - std::move(vm) // - ); -} - -std::unique_ptr Shell::Create( - TaskRunners task_runners, - const PlatformData platform_data, - Settings settings, - fml::RefPtr isolate_snapshot, - const Shell::CreateCallback& on_create_platform_view, - const Shell::CreateCallback& on_create_rasterizer, - DartVMRef vm) { - PerformInitializationTasks(settings); - PersistentCache::SetCacheSkSL(settings.cache_sksl); - - TRACE_EVENT0("flutter", "Shell::CreateWithSnapshots"); - if (!task_runners.IsValid() || !on_create_platform_view || !on_create_rasterizer) { return nullptr; } + auto vm = DartVMRef::Create(settings); + FML_CHECK(vm) << "Must be able to initialize the VM."; + fml::AutoResetWaitableEvent latch; std::unique_ptr shell; fml::TaskRunner::RunNowOrPostTask( task_runners.GetPlatformTaskRunner(), - fml::MakeCopyable([&latch, // - vm = std::move(vm), // - &shell, // - task_runners = std::move(task_runners), // - platform_data, // - settings, // - isolate_snapshot = std::move(isolate_snapshot), // - on_create_platform_view, // - on_create_rasterizer // + fml::MakeCopyable([&latch, // + vm = std::move(vm), // + &shell, // + task_runners = std::move(task_runners), // + platform_data, // + settings, // + on_create_platform_view, // + on_create_rasterizer // ]() mutable { + auto isolate_snapshot = vm->GetVMData()->GetIsolateSnapshot(); shell = CreateShellOnPlatformThread(std::move(vm), std::move(task_runners), // platform_data, // diff --git a/engine/src/flutter/shell/common/shell.h b/engine/src/flutter/shell/common/shell.h index 024d434d16..21214f0013 100644 --- a/engine/src/flutter/shell/common/shell.h +++ b/engine/src/flutter/shell/common/shell.h @@ -169,50 +169,6 @@ class Shell final : public PlatformView::Delegate, CreateCallback on_create_platform_view, CreateCallback on_create_rasterizer); - //---------------------------------------------------------------------------- - /// @brief Creates a shell instance using the provided settings. The - /// callbacks to create the various shell subcomponents will be - /// called on the appropriate threads before this method returns. - /// Unlike the simpler variant of this factory method, this method - /// allows for the specification of an isolate snapshot that - /// cannot be adequately described in the settings. This call also - /// requires the specification of a running VM instance. - /// - /// @param[in] task_runners The task runners - /// @param[in] platform_data The default data for setting up - /// ui.Window that attached to this - /// intance. - /// @param[in] settings The settings - /// @param[in] isolate_snapshot A custom isolate snapshot. Takes - /// precedence over any snapshots - /// specified in the settings. - /// @param[in] on_create_platform_view The callback that must return a - /// platform view. This will be called on - /// the platform task runner before this - /// method returns. - /// @param[in] on_create_rasterizer That callback that must provide a - /// valid rasterizer. This will be called - /// on the render task runner before this - /// method returns. - /// @param[in] vm A running VM instance. - /// - /// @return A full initialized shell if the settings and callbacks are - /// valid. The root isolate has been created but not yet launched. - /// It may be launched by obtaining the engine weak pointer and - /// posting a task onto the UI task runner with a valid run - /// configuration to run the isolate. The embedder must always - /// check the validity of the shell (using the IsSetup call) - /// immediately after getting a pointer to it. - /// - static std::unique_ptr Create( - TaskRunners task_runners, - const PlatformData platform_data, - Settings settings, - fml::RefPtr isolate_snapshot, - const CreateCallback& on_create_platform_view, - const CreateCallback& on_create_rasterizer, - DartVMRef vm); - //---------------------------------------------------------------------------- /// @brief Destroys the shell. This is a synchronous operation and /// synchronous barrier blocks are introduced on the various diff --git a/engine/src/flutter/shell/platform/fuchsia/flutter/component.cc b/engine/src/flutter/shell/platform/fuchsia/flutter/component.cc index 2d3c5c65f5..727011f9f4 100644 --- a/engine/src/flutter/shell/platform/fuchsia/flutter/component.cc +++ b/engine/src/flutter/shell/platform/fuchsia/flutter/component.cc @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -30,17 +31,14 @@ #include "flutter/fml/unique_fd.h" #include "flutter/runtime/dart_vm_lifecycle.h" #include "flutter/shell/common/switches.h" -#include "lib/fdio/io.h" #include "runtime/dart/utils/files.h" #include "runtime/dart/utils/handle_exception.h" #include "runtime/dart/utils/mapped_resource.h" #include "runtime/dart/utils/tempfs.h" #include "runtime/dart/utils/vmo.h" -#include "flutter_runner_product_configuration.h" #include "task_observers.h" #include "task_runner_adapter.h" -#include "thread.h" // TODO(kaushikiska): Use these constants from ::llcpp::fuchsia::io // Can read from target object. @@ -50,6 +48,7 @@ constexpr uint32_t OPEN_RIGHT_READABLE = 1u; constexpr uint32_t OPEN_RIGHT_EXECUTABLE = 8u; namespace flutter_runner { +namespace { constexpr char kDataKey[] = "data"; constexpr char kAssetsKey[] = "assets"; @@ -57,62 +56,69 @@ constexpr char kTmpPath[] = "/tmp"; constexpr char kServiceRootPath[] = "/svc"; constexpr char kRunnerConfigPath[] = "/config/data/flutter_runner_config"; -// static -void Application::ParseProgramMetadata( - const fidl::VectorPtr& program_metadata, - std::string* data_path, - std::string* assets_path) { - if (!program_metadata.has_value()) { - return; +class FileInNamespaceBuffer final : public fml::Mapping { + public: + FileInNamespaceBuffer(int namespace_fd, const char* path, bool executable) + : address_(nullptr), size_(0) { + fuchsia::mem::Buffer buffer; + if (!dart_utils::VmoFromFilenameAt(namespace_fd, path, executable, + &buffer)) { + return; + } + if (buffer.size == 0) { + return; + } + + uint32_t flags = ZX_VM_PERM_READ; + if (executable) { + flags |= ZX_VM_PERM_EXECUTE; + } + uintptr_t addr; + zx_status_t status = + zx::vmar::root_self()->map(flags, 0, buffer.vmo, 0, buffer.size, &addr); + if (status != ZX_OK) { + FML_LOG(FATAL) << "Failed to map " << path << ": " + << zx_status_get_string(status); + } + + address_ = reinterpret_cast(addr); + size_ = buffer.size; } - for (const auto& pg : *program_metadata) { - if (pg.key.compare(kDataKey) == 0) { - *data_path = "pkg/" + pg.value; - } else if (pg.key.compare(kAssetsKey) == 0) { - *assets_path = "pkg/" + pg.value; + + ~FileInNamespaceBuffer() { + if (address_ != nullptr) { + zx::vmar::root_self()->unmap(reinterpret_cast(address_), + size_); + address_ = nullptr; + size_ = 0; } } - // assets_path defaults to the same as data_path if omitted. - if (assets_path->empty()) { - *assets_path = *data_path; + // |fml::Mapping| + const uint8_t* GetMapping() const override { + return reinterpret_cast(address_); } + + // |fml::Mapping| + size_t GetSize() const override { return size_; } + + private: + void* address_; + size_t size_; + + FML_DISALLOW_COPY_AND_ASSIGN(FileInNamespaceBuffer); +}; + +std::unique_ptr CreateWithContentsOfFile(int namespace_fd, + const char* file_path, + bool executable) { + FML_TRACE_EVENT("flutter", "LoadFile", "path", file_path); + return std::make_unique(namespace_fd, file_path, + executable); } -// static -ActiveApplication Application::Create( - TerminationCallback termination_callback, - fuchsia::sys::Package package, - fuchsia::sys::StartupInfo startup_info, - std::shared_ptr runner_incoming_services, - fidl::InterfaceRequest controller) { - std::unique_ptr thread = std::make_unique(); - std::unique_ptr application; - - fml::AutoResetWaitableEvent latch; - async::PostTask(thread->dispatcher(), [&]() mutable { - application.reset( - new Application(std::move(termination_callback), std::move(package), - std::move(startup_info), runner_incoming_services, - std::move(controller))); - latch.Signal(); - }); - - latch.Wait(); - return {.thread = std::move(thread), .application = std::move(application)}; -} - -static std::string DebugLabelForURL(const std::string& url) { - auto found = url.rfind("/"); - if (found == std::string::npos) { - return url; - } else { - return {url, found + 1}; - } -} - -static std::unique_ptr MakeFileMapping(const char* path, - bool executable) { +std::unique_ptr MakeFileMapping(const char* path, + bool executable) { uint32_t flags = OPEN_RIGHT_READABLE; if (executable) { flags |= OPEN_RIGHT_EXECUTABLE; @@ -142,12 +148,58 @@ static std::unique_ptr MakeFileMapping(const char* path, return mapping; } -// Defaults to readonly. If executable is `true`, we treat it as `read + exec`. -static flutter::MappingCallback MakeDataFileMapping(const char* absolute_path, - bool executable = false) { - return [absolute_path, executable = executable](void) { - return MakeFileMapping(absolute_path, executable); - }; +std::string DebugLabelForURL(const std::string& url) { + auto found = url.rfind("/"); + if (found == std::string::npos) { + return url; + } else { + return {url, found + 1}; + } +} + +} // namespace + +void Application::ParseProgramMetadata( + const fidl::VectorPtr& program_metadata, + std::string* data_path, + std::string* assets_path) { + if (!program_metadata.has_value()) { + return; + } + for (const auto& pg : *program_metadata) { + if (pg.key.compare(kDataKey) == 0) { + *data_path = "pkg/" + pg.value; + } else if (pg.key.compare(kAssetsKey) == 0) { + *assets_path = "pkg/" + pg.value; + } + } + + // assets_path defaults to the same as data_path if omitted. + if (assets_path->empty()) { + *assets_path = *data_path; + } +} + +ActiveApplication Application::Create( + TerminationCallback termination_callback, + fuchsia::sys::Package package, + fuchsia::sys::StartupInfo startup_info, + std::shared_ptr runner_incoming_services, + fidl::InterfaceRequest controller) { + std::unique_ptr thread = std::make_unique(); + std::unique_ptr application; + + fml::AutoResetWaitableEvent latch; + async::PostTask(thread->dispatcher(), [&]() mutable { + application.reset( + new Application(std::move(termination_callback), std::move(package), + std::move(startup_info), runner_incoming_services, + std::move(controller))); + latch.Signal(); + }); + + latch.Wait(); + return {.thread = std::move(thread), .application = std::move(application)}; } Application::Application( @@ -309,45 +361,6 @@ Application::Application( application_controller_.Bind(std::move(application_controller_request)); } - // Compare flutter_jit_runner in BUILD.gn. - settings_.vm_snapshot_data = - MakeDataFileMapping("/pkg/data/vm_snapshot_data.bin"); - settings_.vm_snapshot_instr = - MakeDataFileMapping("/pkg/data/vm_snapshot_instructions.bin", true); - - settings_.isolate_snapshot_data = - MakeDataFileMapping("/pkg/data/isolate_core_snapshot_data.bin"); - settings_.isolate_snapshot_instr = MakeDataFileMapping( - "/pkg/data/isolate_core_snapshot_instructions.bin", true); - - { - // Check if we can use the snapshot with the framework already loaded. - std::string runner_framework; - std::string app_framework; - if (dart_utils::ReadFileToString("pkg/data/runner.frameworkversion", - &runner_framework) && - dart_utils::ReadFileToStringAt(application_data_directory_.get(), - "app.frameworkversion", - &app_framework) && - (runner_framework.compare(app_framework) == 0)) { - settings_.vm_snapshot_data = - MakeDataFileMapping("/pkg/data/framework_vm_snapshot_data.bin"); - settings_.vm_snapshot_instr = - MakeDataFileMapping("/pkg/data/vm_snapshot_instructions.bin", true); - - settings_.isolate_snapshot_data = MakeDataFileMapping( - "/pkg/data/framework_isolate_core_snapshot_data.bin"); - settings_.isolate_snapshot_instr = MakeDataFileMapping( - "/pkg/data/isolate_core_snapshot_instructions.bin", true); - - FML_LOG(INFO) << "Using snapshot with framework for " - << package.resolved_url; - } else { - FML_LOG(INFO) << "Using snapshot without framework for " - << package.resolved_url; - } - } - // Load and use runner-specific configuration, if it exists. std::string json_string; if (dart_utils::ReadFileToString(kRunnerConfigPath, &json_string)) { @@ -359,6 +372,77 @@ Application::Application( << kRunnerConfigPath << "; using default config values."; } + // Load VM and application bytecode. + // For AOT, compare with flutter_aot_app in flutter_app.gni. + // For JIT, compare flutter_jit_runner in BUILD.gn. + if (flutter::DartVM::IsRunningPrecompiledCode()) { + std::shared_ptr snapshot = + std::make_shared(); + if (snapshot->Load(application_data_directory_.get(), + "app_aot_snapshot.so")) { + const uint8_t* isolate_data = snapshot->IsolateData(); + const uint8_t* isolate_instructions = snapshot->IsolateInstrs(); + const uint8_t* vm_data = snapshot->VmData(); + const uint8_t* vm_instructions = snapshot->VmInstrs(); + if (isolate_data == nullptr || isolate_instructions == nullptr || + vm_data == nullptr || vm_instructions == nullptr) { + FML_LOG(FATAL) << "ELF snapshot missing AOT symbols."; + return; + } + auto hold_snapshot = [snapshot](const uint8_t* _, size_t __) {}; + settings_.vm_snapshot_data = [hold_snapshot, vm_data]() { + return std::make_unique(vm_data, 0, + hold_snapshot); + }; + settings_.vm_snapshot_instr = [hold_snapshot, vm_instructions]() { + return std::make_unique(vm_instructions, 0, + hold_snapshot); + }; + settings_.isolate_snapshot_data = [hold_snapshot, isolate_data]() { + return std::make_unique(isolate_data, 0, + hold_snapshot); + }; + settings_.isolate_snapshot_instr = [hold_snapshot, + isolate_instructions]() { + return std::make_unique(isolate_instructions, 0, + hold_snapshot); + }; + } else { + const int namespace_fd = application_data_directory_.get(); + settings_.vm_snapshot_data = [namespace_fd]() { + return CreateWithContentsOfFile(namespace_fd, "vm_snapshot_data.bin", + false); + }; + settings_.vm_snapshot_instr = [namespace_fd]() { + return CreateWithContentsOfFile(namespace_fd, + "vm_snapshot_instructions.bin", true); + }; + settings_.isolate_snapshot_data = [namespace_fd]() { + return CreateWithContentsOfFile(namespace_fd, + "isolate_snapshot_data.bin", false); + }; + settings_.isolate_snapshot_instr = [namespace_fd]() { + return CreateWithContentsOfFile( + namespace_fd, "isolate_snapshot_instructions.bin", true); + }; + } + } else { + settings_.vm_snapshot_data = []() { + return MakeFileMapping("/pkg/data/vm_snapshot_data.bin", false); + }; + settings_.vm_snapshot_instr = []() { + return MakeFileMapping("/pkg/data/vm_snapshot_instructions.bin", true); + }; + + settings_.isolate_snapshot_data = []() { + return MakeFileMapping("/pkg/data/isolate_core_snapshot_data.bin", false); + }; + settings_.isolate_snapshot_instr = [] { + return MakeFileMapping("/pkg/data/isolate_core_snapshot_instructions.bin", + true); + }; + } + #if defined(DART_PRODUCT) settings_.enable_observatory = false; #else @@ -397,6 +481,10 @@ Application::Application( settings_.disable_dart_asserts = true; #endif + // Do not leak the VM; allow it to shut down normally when the last shell + // terminates. + settings_.leak_vm = false; + settings_.task_observer_add = std::bind(&CurrentMessageLoopAddAfterTaskObserver, std::placeholders::_1, std::placeholders::_2); @@ -454,8 +542,6 @@ Application::Application( // false to have the error and stack trace printed in the logs. return false; }; - - AttemptVMLaunchWithCurrentSettings(settings_); } Application::~Application() = default; @@ -464,121 +550,6 @@ const std::string& Application::GetDebugLabel() const { return debug_label_; } -class FileInNamespaceBuffer final : public fml::Mapping { - public: - FileInNamespaceBuffer(int namespace_fd, const char* path, bool executable) - : address_(nullptr), size_(0) { - fuchsia::mem::Buffer buffer; - if (!dart_utils::VmoFromFilenameAt(namespace_fd, path, executable, - &buffer)) { - return; - } - if (buffer.size == 0) { - return; - } - - uint32_t flags = ZX_VM_PERM_READ; - if (executable) { - flags |= ZX_VM_PERM_EXECUTE; - } - uintptr_t addr; - zx_status_t status = - zx::vmar::root_self()->map(flags, 0, buffer.vmo, 0, buffer.size, &addr); - if (status != ZX_OK) { - FML_LOG(FATAL) << "Failed to map " << path << ": " - << zx_status_get_string(status); - } - - address_ = reinterpret_cast(addr); - size_ = buffer.size; - } - - ~FileInNamespaceBuffer() { - if (address_ != nullptr) { - zx::vmar::root_self()->unmap(reinterpret_cast(address_), - size_); - address_ = nullptr; - size_ = 0; - } - } - - // |fml::Mapping| - const uint8_t* GetMapping() const override { - return reinterpret_cast(address_); - } - - // |fml::Mapping| - size_t GetSize() const override { return size_; } - - private: - void* address_; - size_t size_; - - FML_DISALLOW_COPY_AND_ASSIGN(FileInNamespaceBuffer); -}; - -std::unique_ptr CreateWithContentsOfFile(int namespace_fd, - const char* file_path, - bool executable) { - FML_TRACE_EVENT("flutter", "LoadFile", "path", file_path); - auto source = std::make_unique(namespace_fd, file_path, - executable); - return source->GetMapping() == nullptr ? nullptr : std::move(source); -} - -void Application::AttemptVMLaunchWithCurrentSettings( - const flutter::Settings& settings) { - if (!flutter::DartVM::IsRunningPrecompiledCode()) { - // We will be initializing the VM lazily in this case. - return; - } - - // Compare with flutter_aot_app in flutter_app.gni. - fml::RefPtr vm_snapshot; - - std::shared_ptr snapshot = - std::make_shared(); - if (snapshot->Load(application_data_directory_.get(), - "app_aot_snapshot.so")) { - const uint8_t* isolate_data = snapshot->IsolateData(); - const uint8_t* isolate_instructions = snapshot->IsolateInstrs(); - const uint8_t* vm_data = snapshot->VmData(); - const uint8_t* vm_instructions = snapshot->VmInstrs(); - if (isolate_data == nullptr || isolate_instructions == nullptr || - vm_data == nullptr || vm_instructions == nullptr) { - FML_LOG(FATAL) << "ELF snapshot missing AOT symbols."; - return; - } - auto hold_snapshot = [snapshot](const uint8_t* _, size_t __) {}; - vm_snapshot = fml::MakeRefCounted( - std::make_shared(vm_data, 0, hold_snapshot), - std::make_shared(vm_instructions, 0, - hold_snapshot)); - isolate_snapshot_ = fml::MakeRefCounted( - std::make_shared(isolate_data, 0, hold_snapshot), - std::make_shared(isolate_instructions, 0, - hold_snapshot)); - } else { - vm_snapshot = fml::MakeRefCounted( - CreateWithContentsOfFile(application_data_directory_.get(), - "vm_snapshot_data.bin", false), - CreateWithContentsOfFile(application_data_directory_.get(), - "vm_snapshot_instructions.bin", true)); - - isolate_snapshot_ = fml::MakeRefCounted( - CreateWithContentsOfFile(application_data_directory_.get(), - "isolate_snapshot_data.bin", false), - CreateWithContentsOfFile(application_data_directory_.get(), - "isolate_snapshot_instructions.bin", true)); - } - - auto vm = flutter::DartVMRef::Create(settings_, // - std::move(vm_snapshot), // - isolate_snapshot_ // - ); - FML_CHECK(vm) << "Mut be able to initialize the VM."; -} - void Application::Kill() { application_controller_.events().OnTerminated( last_return_code_.second, fuchsia::sys::TerminationReason::EXITED); @@ -641,12 +612,11 @@ void Application::CreateViewWithViewRef( } shell_holders_.emplace(std::make_unique( - *this, // delegate - debug_label_, // thread label - svc_, // Component incoming services - runner_incoming_services_, // Runner incoming services - settings_, // settings - std::move(isolate_snapshot_), // isolate snapshot + *this, // delegate + debug_label_, // thread label + svc_, // Component incoming services + runner_incoming_services_, // Runner incoming services + settings_, // settings scenic::ToViewToken(std::move(view_token)), // view token scenic::ViewRefPair{ .control_ref = std::move(control_ref), diff --git a/engine/src/flutter/shell/platform/fuchsia/flutter/component.h b/engine/src/flutter/shell/platform/fuchsia/flutter/component.h index 7c4cc12110..df9498b070 100644 --- a/engine/src/flutter/shell/platform/fuchsia/flutter/component.h +++ b/engine/src/flutter/shell/platform/fuchsia/flutter/component.h @@ -21,10 +21,10 @@ #include #include -#include "engine.h" #include "flutter/common/settings.h" #include "flutter/fml/macros.h" +#include "engine.h" #include "flutter_runner_product_configuration.h" #include "thread.h" #include "unique_fdio_ns.h" @@ -132,8 +132,6 @@ class Application final : public Engine::Delegate, // |flutter::Engine::Delegate| void OnEngineTerminate(const Engine* holder) override; - void AttemptVMLaunchWithCurrentSettings(const flutter::Settings& settings); - FML_DISALLOW_COPY_AND_ASSIGN(Application); }; diff --git a/engine/src/flutter/shell/platform/fuchsia/flutter/engine.cc b/engine/src/flutter/shell/platform/fuchsia/flutter/engine.cc index bb824c2ac7..1a3f7ebf8c 100644 --- a/engine/src/flutter/shell/platform/fuchsia/flutter/engine.cc +++ b/engine/src/flutter/shell/platform/fuchsia/flutter/engine.cc @@ -7,8 +7,6 @@ #include #include -#include "../runtime/dart/utils/files.h" -#include "flow/embedded_views.h" #include "flutter/common/graphics/persistent_cache.h" #include "flutter/common/task_runners.h" #include "flutter/fml/make_copyable.h" @@ -18,16 +16,15 @@ #include "flutter/shell/common/rasterizer.h" #include "flutter/shell/common/run_configuration.h" #include "flutter/shell/common/serialization_callbacks.h" -#include "flutter_runner_product_configuration.h" -#include "fuchsia_external_view_embedder.h" +#include "third_party/skia/include/core/SkPicture.h" +#include "third_party/skia/include/core/SkSerialProcs.h" +#include "third_party/skia/include/ports/SkFontMgr_fuchsia.h" + +#include "../runtime/dart/utils/files.h" #include "fuchsia_intl.h" -#include "include/core/SkPicture.h" -#include "include/core/SkSerialProcs.h" #include "platform_view.h" #include "surface.h" #include "task_runner_adapter.h" -#include "third_party/skia/include/ports/SkFontMgr_fuchsia.h" -#include "thread.h" #if defined(LEGACY_FUCHSIA_EMBEDDER) #include "compositor_context.h" // nogncheck @@ -67,7 +64,6 @@ Engine::Engine(Delegate& delegate, 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, @@ -310,22 +306,14 @@ Engine::Engine(Delegate& delegate, }); }); - auto vm = flutter::DartVMRef::Create(settings); - - if (!isolate_snapshot) { - isolate_snapshot = vm->GetVMData()->GetIsolateSnapshot(); - } - { TRACE_EVENT0("flutter", "CreateShell"); shell_ = flutter::Shell::Create( std::move(task_runners), // host task runners flutter::PlatformData(), // default window data std::move(settings), // shell launch settings - std::move(isolate_snapshot), // isolate snapshot std::move(on_create_platform_view), // platform view create callback - std::move(on_create_rasterizer), // rasterizer create callback - std::move(vm) // vm reference + std::move(on_create_rasterizer) // rasterizer create callback ); } diff --git a/engine/src/flutter/shell/platform/fuchsia/flutter/engine.h b/engine/src/flutter/shell/platform/fuchsia/flutter/engine.h index b710ac4bc5..9fd5c60782 100644 --- a/engine/src/flutter/shell/platform/fuchsia/flutter/engine.h +++ b/engine/src/flutter/shell/platform/fuchsia/flutter/engine.h @@ -16,7 +16,7 @@ #include #include -#include "flow/embedded_views.h" +#include "flutter/flow/embedded_views.h" #include "flutter/flow/surface.h" #include "flutter/fml/macros.h" #include "flutter/shell/common/shell.h" @@ -52,7 +52,6 @@ class Engine final { 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,