Read platform kernel blob from asset directory instead of FLX (flutter/engine#4471)
This commit is contained in:
@@ -608,9 +608,10 @@ void InitDartVM(const uint8_t* vm_snapshot_data,
|
||||
#endif
|
||||
|
||||
if (!bundle_path.empty()) {
|
||||
auto zip_asset_store = fxl::MakeRefCounted<ZipAssetStore>(
|
||||
GetUnzipperProviderForPath(std::move(bundle_path)));
|
||||
zip_asset_store->GetAsBuffer(kPlatformKernelAssetKey, &platform_data);
|
||||
fxl::RefPtr<blink::DirectoryAssetBundle> directory_asset_bundle =
|
||||
fxl::MakeRefCounted<blink::DirectoryAssetBundle>(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);
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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";
|
||||
|
||||
Reference in New Issue
Block a user