Log an error and cancel DartVM init if the VM/isolate snapshots are invalid (#5449)

See https://github.com/flutter/flutter/issues/18101
This commit is contained in:
Jason Simmons 2018-06-01 17:34:25 -07:00 committed by GitHub
parent 50f623ab64
commit 78f46bd427
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -251,9 +251,17 @@ fxl::RefPtr<DartVM> DartVM::ForProcess(
if (!vm_snapshot) {
vm_snapshot = DartSnapshot::VMSnapshotFromSettings(settings);
}
if (!(vm_snapshot && vm_snapshot->IsValid())) {
FXL_LOG(ERROR) << "VM snapshot must be valid.";
return;
}
if (!isolate_snapshot) {
isolate_snapshot = DartSnapshot::IsolateSnapshotFromSettings(settings);
}
if (!(isolate_snapshot && isolate_snapshot->IsValid())) {
FXL_LOG(ERROR) << "Isolate snapshot must be valid.";
return;
}
if (!shared_snapshot) {
shared_snapshot = DartSnapshot::Empty();
}
@ -285,12 +293,6 @@ DartVM::DartVM(const Settings& settings,
FXL_DLOG(INFO) << "Attempting Dart VM launch for mode: "
<< (IsRunningPrecompiledCode() ? "AOT" : "Interpreter");
FXL_DCHECK(vm_snapshot_ && vm_snapshot_->IsValid())
<< "VM snapshot must be valid.";
FXL_DCHECK(isolate_snapshot_ && isolate_snapshot_->IsValid())
<< "Isolate snapshot must be valid.";
{
TRACE_EVENT0("flutter", "dart::bin::BootstrapDartIo");
dart::bin::BootstrapDartIo();