Use Dart_Closure instead of looking up _getMainClosure (flutter/engine#3850)
* Use Dart_Closure instead of looking up _getMainClosure * Restore comment * Fix comment * Restore comment
This commit is contained in:
committed by
GitHub
parent
cff3c24418
commit
f559923e43
@@ -72,24 +72,17 @@ bool DartController::SendStartMessage(Dart_Handle root_library) {
|
||||
|
||||
// In order to support pausing the isolate at start, we indirectly invoke
|
||||
// main by sending a message to the isolate.
|
||||
// Grab the 'dart:ui' library.
|
||||
Dart_Handle ui_library = Dart_LookupLibrary(ToDart("dart:ui"));
|
||||
DART_CHECK_VALID(ui_library);
|
||||
|
||||
// Get the closure of main().
|
||||
Dart_Handle main_closure =
|
||||
Dart_GetClosure(root_library, Dart_NewStringFromCString("main"));
|
||||
if (LogIfError(main_closure))
|
||||
return true;
|
||||
|
||||
// Grab the 'dart:isolate' library.
|
||||
Dart_Handle isolate_lib = Dart_LookupLibrary(ToDart("dart:isolate"));
|
||||
DART_CHECK_VALID(isolate_lib);
|
||||
|
||||
// Import the root library into the 'dart:ui' library so that we can
|
||||
// reach main.
|
||||
Dart_LibraryImportLibrary(ui_library, root_library, Dart_Null());
|
||||
|
||||
// Get the closure of main().
|
||||
Dart_Handle main_closure =
|
||||
Dart_Invoke(ui_library, ToDart("_getMainClosure"), 0, NULL);
|
||||
if (LogIfError(main_closure))
|
||||
return true;
|
||||
|
||||
// Send the start message containing the entry point by calling
|
||||
// _startMainIsolate in dart:isolate.
|
||||
const intptr_t kNumIsolateArgs = 2;
|
||||
|
||||
Reference in New Issue
Block a user