@@ -577,6 +577,7 @@ bool DartIsolate::LoadKernel(std::shared_ptr<const fml::Mapping> mapping,
577
577
578
578
[[nodiscard]] bool DartIsolate::PrepareForRunningFromKernel (
579
579
std::shared_ptr<const fml::Mapping> mapping,
580
+ bool child_isolate,
580
581
bool last_piece) {
581
582
TRACE_EVENT0 (" flutter" , " DartIsolate::PrepareForRunningFromKernel" );
582
583
if (phase_ != Phase::LibrariesSetup) {
@@ -593,11 +594,13 @@ bool DartIsolate::LoadKernel(std::shared_ptr<const fml::Mapping> mapping,
593
594
594
595
tonic::DartState::Scope scope (this );
595
596
596
- // Use root library provided by kernel in favor of one provided by snapshot.
597
- Dart_SetRootLibrary (Dart_Null ());
597
+ if (!child_isolate || !Dart_IsVMFlagSet (" --enable-isolate-groups" )) {
598
+ // Use root library provided by kernel in favor of one provided by snapshot.
599
+ Dart_SetRootLibrary (Dart_Null ());
598
600
599
- if (!LoadKernel (mapping, last_piece)) {
600
- return false ;
601
+ if (!LoadKernel (mapping, last_piece)) {
602
+ return false ;
603
+ }
601
604
}
602
605
603
606
if (!last_piece) {
@@ -622,7 +625,9 @@ bool DartIsolate::LoadKernel(std::shared_ptr<const fml::Mapping> mapping,
622
625
for (uint64_t i = 0 ; i < buffers.size (); i++) {
623
626
bool last_piece = i + 1 == buffers.size ();
624
627
const std::shared_ptr<const fml::Mapping>& buffer = buffers.at (i);
625
- if (!isolate->PrepareForRunningFromKernel (buffer, last_piece)) {
628
+ if (!isolate->PrepareForRunningFromKernel (buffer,
629
+ /* child_isolate=*/ true ,
630
+ last_piece)) {
626
631
return false ;
627
632
}
628
633
}
@@ -650,7 +655,8 @@ bool DartIsolate::LoadKernel(std::shared_ptr<const fml::Mapping> mapping,
650
655
651
656
for (size_t i = 0 ; i < count; ++i) {
652
657
bool last = (i == (count - 1 ));
653
- if (!PrepareForRunningFromKernel (kernels[i], last)) {
658
+ if (!PrepareForRunningFromKernel (kernels[i], /* child_isolate=*/ false ,
659
+ last)) {
654
660
return false ;
655
661
}
656
662
}
0 commit comments