Skip to content

Commit

Permalink
Read platform kernel blob from asset directory instead of FLX (flutte…
Browse files Browse the repository at this point in the history
  • Loading branch information
szakarias authored Dec 18, 2017
1 parent 0545882 commit 1c46319
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 15 deletions.
7 changes: 4 additions & 3 deletions runtime/dart_init.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions runtime/dart_init.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
10 changes: 1 addition & 9 deletions shell/common/engine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down

0 comments on commit 1c46319

Please sign in to comment.