From 1c463196773f813a1605e9fe6cdbe24c188054a5 Mon Sep 17 00:00:00 2001 From: Sarah Zakarias Date: Mon, 18 Dec 2017 13:15:01 +0100 Subject: [PATCH] Read platform kernel blob from asset directory instead of FLX (#4471) --- runtime/dart_init.cc | 7 ++++--- runtime/dart_init.h | 6 +++--- shell/common/engine.cc | 10 +--------- 3 files changed, 8 insertions(+), 15 deletions(-) diff --git a/runtime/dart_init.cc b/runtime/dart_init.cc index 8211b29a2e..2abcc21300 100644 --- a/runtime/dart_init.cc +++ b/runtime/dart_init.cc @@ -608,9 +608,10 @@ void InitDartVM(const uint8_t* vm_snapshot_data, #endif if (!bundle_path.empty()) { - auto zip_asset_store = fxl::MakeRefCounted( - GetUnzipperProviderForPath(std::move(bundle_path))); - zip_asset_store->GetAsBuffer(kPlatformKernelAssetKey, &platform_data); + fxl::RefPtr directory_asset_bundle = + fxl::MakeRefCounted(std::move(bundle_path)); + directory_asset_bundle->GetAsBuffer(kPlatformKernelAssetKey, + &platform_data); if (!platform_data.empty()) { kernel_platform = Dart_ReadKernelBinary( platform_data.data(), platform_data.size(), ReleaseFetchedBytes); diff --git a/runtime/dart_init.h b/runtime/dart_init.h index 62c69c6a39..99c8fe8913 100644 --- a/runtime/dart_init.h +++ b/runtime/dart_init.h @@ -15,13 +15,13 @@ namespace blink { -// Name of the kernel blob asset within the FLX bundle. +// Name of the kernel blob asset within the asset directory. extern const char kKernelAssetKey[]; -// Name of the snapshot blob asset within the FLX bundle. +// Name of the snapshot blob asset within the asset directory. extern const char kSnapshotAssetKey[]; -// Name of the platform kernel blob asset within the FLX bundle. +// Name of the platform kernel blob asset within the asset directory. extern const char kPlatformKernelAssetKey[]; bool IsRunningPrecompiledCode(); diff --git a/shell/common/engine.cc b/shell/common/engine.cc index 77f6d33c25..9f63afdf0e 100644 --- a/shell/common/engine.cc +++ b/shell/common/engine.cc @@ -289,17 +289,9 @@ void Engine::Init(const std::string& bundle_path) { #error Unknown OS #endif - std::string flx_path = bundle_path; - struct stat stat_result = {}; - if (::stat(flx_path.c_str(), &stat_result) == 0) { - if (S_ISDIR(stat_result.st_mode)) { - flx_path = files::GetDirectoryName(bundle_path) + "/app.flx"; - } - } - blink::InitRuntime(vm_snapshot_data, vm_snapshot_instr, default_isolate_snapshot_data, - default_isolate_snapshot_instr, flx_path); + default_isolate_snapshot_instr, bundle_path); } const std::string Engine::main_entrypoint_ = "main"; -- GitLab