2424#include < regex>
2525#include < utility>
2626
27- #include " runtime/dart/utils/files.h"
2827#include " runtime/dart/utils/handle_exception.h"
2928#include " runtime/dart/utils/inlines.h"
3029#include " runtime/dart/utils/tempfs.h"
@@ -194,18 +193,18 @@ bool DartComponentController::SetupNamespace() {
194193}
195194
196195bool DartComponentController::SetupFromKernel () {
197- dart_utils:: MappedResource manifest;
198- if (!dart_utils:: MappedResource::LoadFromNamespace (
196+ MappedResource manifest;
197+ if (!MappedResource::LoadFromNamespace (
199198 namespace_, data_path_ + " /app.dilplist" , manifest)) {
200199 return false ;
201200 }
202201
203- if (!dart_utils:: MappedResource::LoadFromNamespace (
202+ if (!MappedResource::LoadFromNamespace (
204203 nullptr , " pkg/data/isolate_core_snapshot_data.bin" ,
205204 isolate_snapshot_data_)) {
206205 return false ;
207206 }
208- if (!dart_utils:: MappedResource::LoadFromNamespace (
207+ if (!MappedResource::LoadFromNamespace (
209208 nullptr , " pkg/data/isolate_core_snapshot_instructions.bin" ,
210209 isolate_snapshot_instructions_, true /* executable */ )) {
211210 return false ;
@@ -232,9 +231,8 @@ bool DartComponentController::SetupFromKernel() {
232231 std::string path = data_path_ + " /" + str.substr (start, end - start);
233232 start = end + 1 ;
234233
235- dart_utils::MappedResource kernel;
236- if (!dart_utils::MappedResource::LoadFromNamespace (namespace_, path,
237- kernel)) {
234+ MappedResource kernel;
235+ if (!MappedResource::LoadFromNamespace (namespace_, path, kernel)) {
238236 FX_LOGF (ERROR, LOG_TAG, " Failed to find kernel: %s" , path.c_str ());
239237 Dart_ExitScope ();
240238 return false ;
@@ -264,30 +262,25 @@ bool DartComponentController::SetupFromKernel() {
264262
265263bool DartComponentController::SetupFromAppSnapshot () {
266264#if !defined(AOT_RUNTIME)
265+ // If we start generating app-jit snapshots, the code below should be able
266+ // handle that case without modification.
267267 return false ;
268268#else
269- // Load the ELF snapshot as available, and fall back to a blobs snapshot
270- // otherwise.
271- const uint8_t *isolate_data, *isolate_instructions;
272- if (elf_snapshot_.Load (namespace_, data_path_ + " /app_aot_snapshot.so" )) {
273- isolate_data = elf_snapshot_.IsolateData ();
274- isolate_instructions = elf_snapshot_.IsolateInstrs ();
275- if (isolate_data == nullptr || isolate_instructions == nullptr ) {
276- return false ;
277- }
278- } else {
279- if (!dart_utils::MappedResource::LoadFromNamespace (
280- namespace_, data_path_ + " /isolate_snapshot_data.bin" ,
281- isolate_snapshot_data_)) {
282- return false ;
283- }
284- if (!dart_utils::MappedResource::LoadFromNamespace (
285- namespace_, data_path_ + " /isolate_snapshot_instructions.bin" ,
286- isolate_snapshot_instructions_, true /* executable */ )) {
287- return false ;
288- }
269+
270+ if (!MappedResource::LoadFromNamespace (
271+ namespace_, data_path_ + " /isolate_snapshot_data.bin" ,
272+ isolate_snapshot_data_)) {
273+ return false ;
289274 }
290- return CreateIsolate (isolate_data, isolate_instructions);
275+
276+ if (!MappedResource::LoadFromNamespace (
277+ namespace_, data_path_ + " /isolate_snapshot_instructions.bin" ,
278+ isolate_snapshot_instructions_, true /* executable */ )) {
279+ return false ;
280+ }
281+
282+ return CreateIsolate (isolate_snapshot_data_.address (),
283+ isolate_snapshot_instructions_.address ());
291284#endif // defined(AOT_RUNTIME)
292285}
293286
0 commit comments