未验证 提交 14ee957f 编写于 作者: A Alexander Aprelev 提交者: GitHub

Set up secondary isolates with all kernel buffers rather than just one buffer. (#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
上级 76522eb2
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册