Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 7b3ca93

Browse files
committed
In case the Dart VM cannot be initialized, log the reason before terminating the process. (#2668)
1 parent fcbfd1c commit 7b3ca93

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

sky/engine/core/script/dart_init.cc

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -544,21 +544,22 @@ void InitDartVM() {
544544

545545
{
546546
TRACE_EVENT0("flutter", "Dart_Initialize");
547-
CHECK(Dart_Initialize(reinterpret_cast<uint8_t*>(
548-
DART_SYMBOL(kDartVmIsolateSnapshotBuffer)),
549-
PrecompiledInstructionsSymbolIfPresent(),
550-
PrecompiledDataSnapshotSymbolIfPresent(),
551-
IsolateCreateCallback,
552-
nullptr, // Isolate interrupt callback.
553-
nullptr,
554-
IsolateShutdownCallback,
555-
ThreadExitCallback,
556-
// File IO callbacks.
557-
nullptr, nullptr, nullptr, nullptr,
558-
// Entroy source
559-
nullptr,
560-
// VM service assets archive
561-
GetVMServiceAssetsArchiveCallback) == nullptr);
547+
char* init_error = Dart_Initialize(
548+
reinterpret_cast<uint8_t*>(DART_SYMBOL(kDartVmIsolateSnapshotBuffer)),
549+
PrecompiledInstructionsSymbolIfPresent(),
550+
PrecompiledDataSnapshotSymbolIfPresent(), IsolateCreateCallback,
551+
nullptr, // Isolate interrupt callback.
552+
nullptr, IsolateShutdownCallback, ThreadExitCallback,
553+
// File IO callbacks.
554+
nullptr, nullptr, nullptr, nullptr,
555+
// Entroy source
556+
nullptr,
557+
// VM service assets archive
558+
GetVMServiceAssetsArchiveCallback);
559+
LOG_IF(ERROR, init_error != nullptr)
560+
<< "Error while initializing the Dart VM: " << init_error;
561+
CHECK(init_error == nullptr);
562+
free(init_error);
562563

563564
// Send the earliest available timestamp in the application lifecycle to
564565
// timeline. The difference between this timestamp and the time we render the

0 commit comments

Comments
 (0)