diff --git a/engine/src/flutter/common/settings.h b/engine/src/flutter/common/settings.h index e3901b92cd3..7fe3f9b8bd3 100644 --- a/engine/src/flutter/common/settings.h +++ b/engine/src/flutter/common/settings.h @@ -13,6 +13,7 @@ namespace blink { struct Settings { + bool enable_observatory = false; // Port on target will be auto selected by the OS. A message will be printed // on the target with the port after it has been selected. uint32_t observatory_port = 0; diff --git a/engine/src/flutter/runtime/dart_init.cc b/engine/src/flutter/runtime/dart_init.cc index 2546b37cc2b..e14970ececc 100644 --- a/engine/src/flutter/runtime/dart_init.cc +++ b/engine/src/flutter/runtime/dart_init.cc @@ -203,14 +203,15 @@ Dart_Isolate ServiceIsolateCreateCallback(const char* script_uri, DartMojoInternal::InitForIsolate(); DartRuntimeHooks::Install(DartRuntimeHooks::SecondaryIsolate, script_uri); const Settings& settings = Settings::Get(); - - std::string ip = "127.0.0.1"; - const intptr_t port = settings.observatory_port; - const bool disable_websocket_origin_check = false; - const bool service_isolate_booted = DartServiceIsolate::Startup( - ip, port, tonic::DartState::HandleLibraryTag, - IsRunningPrecompiledCode(), disable_websocket_origin_check, error); - FTL_CHECK(service_isolate_booted) << error; + if (settings.enable_observatory) { + std::string ip = "127.0.0.1"; + const intptr_t port = settings.observatory_port; + const bool disable_websocket_origin_check = false; + const bool service_isolate_booted = DartServiceIsolate::Startup( + ip, port, tonic::DartState::HandleLibraryTag, + IsRunningPrecompiledCode(), disable_websocket_origin_check, error); + FTL_CHECK(service_isolate_booted) << error; + } if (g_service_isolate_hook) g_service_isolate_hook(IsRunningPrecompiledCode());