From 613ea2c91f231cb32e71ed78c493d58e95058a53 Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Fri, 9 Sep 2016 15:54:07 -0700 Subject: [PATCH] =?UTF-8?q?Add=20a=20=E2=80=94disable-observatory=20flag?= =?UTF-8?q?=20to=20explicitly=20disable=20observatory=20even=20in=20non-pr?= =?UTF-8?q?oduct=20modes.=20(flutter/engine#3012)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- engine/src/flutter/common/settings.h | 1 + engine/src/flutter/runtime/dart_init.cc | 17 +++++++++-------- 2 files changed, 10 insertions(+), 8 deletions(-) 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());