Set up secondary isolates with all kernel buffers rather than just one buffer. (flutter/engine#6832)
* Set up secondary isolates with all kernel buffers rather than just one buffer. * Capture copy of the list * Make sure child_isolate_preparer_ is initialized only once
This commit is contained in:
committed by
GitHub
parent
84f8c75f40
commit
4d4a493a97
@@ -348,9 +348,22 @@ bool DartIsolate::PrepareForRunningFromKernel(
|
||||
return false;
|
||||
}
|
||||
|
||||
child_isolate_preparer_ = [mapping](DartIsolate* isolate) {
|
||||
return isolate->PrepareForRunningFromKernel(mapping);
|
||||
};
|
||||
// Child isolate shares root isolate embedder_isolate (lines 691 and 693
|
||||
// below). Re-initializing child_isolate_preparer_ lambda while it is being
|
||||
// executed leads to crashes.
|
||||
if (child_isolate_preparer_ == nullptr) {
|
||||
child_isolate_preparer_ = [buffers =
|
||||
kernel_buffers_](DartIsolate* isolate) {
|
||||
for (unsigned long i = 0; i < buffers.size(); i++) {
|
||||
bool last_piece = i + 1 == buffers.size();
|
||||
const std::shared_ptr<const fml::Mapping>& buffer = buffers.at(i);
|
||||
if (!isolate->PrepareForRunningFromKernel(buffer, last_piece)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
};
|
||||
}
|
||||
phase_ = Phase::Ready;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ class DartIsolate : public UIDartState {
|
||||
const fml::RefPtr<DartSnapshot> shared_snapshot_;
|
||||
std::vector<std::shared_ptr<const fml::Mapping>> kernel_buffers_;
|
||||
std::vector<std::unique_ptr<AutoFireClosure>> shutdown_callbacks_;
|
||||
ChildIsolatePreparer child_isolate_preparer_;
|
||||
ChildIsolatePreparer child_isolate_preparer_ = nullptr;
|
||||
|
||||
FML_WARN_UNUSED_RESULT
|
||||
bool Initialize(Dart_Isolate isolate, bool is_root_isolate);
|
||||
|
||||
Reference in New Issue
Block a user