From 0dedb56d2f4b859ffd2df0484729c80e2f8950c6 Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Thu, 24 Jan 2019 14:22:39 -0800 Subject: [PATCH] [embedder] Avoid looking for the kernel binary in AOT builds. (#7577) --- shell/platform/embedder/embedder.cc | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/shell/platform/embedder/embedder.cc b/shell/platform/embedder/embedder.cc index 66d97459c..d3cff5cfb 100644 --- a/shell/platform/embedder/embedder.cc +++ b/shell/platform/embedder/embedder.cc @@ -342,14 +342,18 @@ FlutterResult FlutterEngineRun(size_t version, settings.icu_data_path = icu_data_path; settings.assets_path = args->assets_path; - // Verify the assets path contains Dart 2 kernel assets. - const std::string kApplicationKernelSnapshotFileName = "kernel_blob.bin"; - std::string application_kernel_path = fml::paths::JoinPaths( - {settings.assets_path, kApplicationKernelSnapshotFileName}); - if (!fml::IsFile(application_kernel_path)) { - return kInvalidArguments; + if (!blink::DartVM::IsRunningPrecompiledCode()) { + // Verify the assets path contains Dart 2 kernel assets. + const std::string kApplicationKernelSnapshotFileName = "kernel_blob.bin"; + std::string application_kernel_path = fml::paths::JoinPaths( + {settings.assets_path, kApplicationKernelSnapshotFileName}); + if (!fml::IsFile(application_kernel_path)) { + FML_LOG(ERROR) << "Not running in AOT mode but could not resolve the " + "kernel binary."; + return kInvalidArguments; + } + settings.application_kernel_asset = kApplicationKernelSnapshotFileName; } - settings.application_kernel_asset = kApplicationKernelSnapshotFileName; settings.task_observer_add = [](intptr_t key, fml::closure callback) { fml::MessageLoop::GetCurrent().AddTaskObserver(key, std::move(callback)); -- GitLab