From 7cea2d1361b1cfd33fb0da42fc784e1d029d814e Mon Sep 17 00:00:00 2001 From: Dan Field Date: Tue, 6 Sep 2022 13:26:49 -0700 Subject: [PATCH] Try to deflake service isolate startup (flutter/engine#35950) --- .../flutter/runtime/dart_service_isolate.cc | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/engine/src/flutter/runtime/dart_service_isolate.cc b/engine/src/flutter/runtime/dart_service_isolate.cc index 2fb9932e4e..e819f6e97c 100644 --- a/engine/src/flutter/runtime/dart_service_isolate.cc +++ b/engine/src/flutter/runtime/dart_service_isolate.cc @@ -157,18 +157,6 @@ bool DartServiceIsolate::Startup(std::string server_ip, result = Dart_SetNativeResolver(library, GetNativeFunction, GetSymbol); SHUTDOWN_ON_ERROR(result); - // Make runnable. - Dart_ExitScope(); - Dart_ExitIsolate(); - *error = Dart_IsolateMakeRunnable(isolate); - if (*error) { - Dart_EnterIsolate(isolate); - Dart_ShutdownIsolate(); - return false; - } - Dart_EnterIsolate(isolate); - Dart_EnterScope(); - library = Dart_RootLibrary(); SHUTDOWN_ON_ERROR(library); @@ -202,6 +190,19 @@ bool DartServiceIsolate::Startup(std::string server_ip, library, Dart_NewStringFromCString("_enableServicePortFallback"), Dart_NewBoolean(enable_service_port_fallback)); SHUTDOWN_ON_ERROR(result); + + // Make runnable. + Dart_ExitScope(); + Dart_ExitIsolate(); + *error = Dart_IsolateMakeRunnable(isolate); + if (*error) { + Dart_EnterIsolate(isolate); + Dart_ShutdownIsolate(); + return false; + } + Dart_EnterIsolate(isolate); + Dart_EnterScope(); + return true; }