未验证 提交 1c463196 编写于 作者: S Sarah Zakarias 提交者: GitHub

Read platform kernel blob from asset directory instead of FLX (#4471)

上级 05458826
......@@ -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";
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册