From 53df117523e1b6d46a731a3945b710da64411831 Mon Sep 17 00:00:00 2001 From: Jason Simmons Date: Tue, 20 Mar 2018 17:25:22 -0700 Subject: [PATCH] Load kernel files from the script URI in the isolate create callback (flutter/engine#4828) Fixes https://github.com/flutter/flutter/issues/15731 --- engine/src/flutter/runtime/dart_init.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/engine/src/flutter/runtime/dart_init.cc b/engine/src/flutter/runtime/dart_init.cc index 776619e324..e3d88322a4 100644 --- a/engine/src/flutter/runtime/dart_init.cc +++ b/engine/src/flutter/runtime/dart_init.cc @@ -336,8 +336,13 @@ Dart_Isolate IsolateCreateCallback(const char* script_uri, } // Entry script path (file:// is stripped). entry_path = std::string(script_uri + strlen(kFileUriPrefix)); - if (!running_from_source) { - // Attempt to copy the snapshot from the asset bundle. + if (StringEndsWith(entry_path, ".dill")) { + // Load the kernel from the script URI. + if (!files::ReadFileToVector(entry_path, &kernel_data)) { + FXL_LOG(ERROR) << "Failed to load kernel"; + } + } else if (!running_from_source) { + // Attempt to copy the snapshot or kernel from the asset bundle. const std::string& bundle_path = entry_path; struct stat stat_result = {};