diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter index dda5c027a1c86..338372d4227c1 100644 --- a/ci/licenses_golden/licenses_flutter +++ b/ci/licenses_golden/licenses_flutter @@ -2508,8 +2508,6 @@ ORIGIN: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterChann ORIGIN: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterDartProject.mm + ../../../flutter/LICENSE ORIGIN: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterDartProjectTest.mm + ../../../flutter/LICENSE ORIGIN: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterDartProject_Internal.h + ../../../flutter/LICENSE -ORIGIN: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterDartVMServicePublisher.h + ../../../flutter/LICENSE -ORIGIN: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterDartVMServicePublisher.mm + ../../../flutter/LICENSE ORIGIN: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterEmbedderKeyResponder.h + ../../../flutter/LICENSE ORIGIN: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterEmbedderKeyResponder.mm + ../../../flutter/LICENSE ORIGIN: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterEmbedderKeyResponderTest.mm + ../../../flutter/LICENSE @@ -2530,6 +2528,8 @@ ORIGIN: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterKeySe ORIGIN: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterKeyboardManager.h + ../../../flutter/LICENSE ORIGIN: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterKeyboardManager.mm + ../../../flutter/LICENSE ORIGIN: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterKeyboardManagerTest.mm + ../../../flutter/LICENSE +ORIGIN: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterObservatoryPublisher.h + ../../../flutter/LICENSE +ORIGIN: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterObservatoryPublisher.mm + ../../../flutter/LICENSE ORIGIN: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterOverlayView.h + ../../../flutter/LICENSE ORIGIN: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterOverlayView.mm + ../../../flutter/LICENSE ORIGIN: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterPlatformPlugin.h + ../../../flutter/LICENSE @@ -4996,8 +4996,6 @@ FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterChannel FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterDartProject.mm FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterDartProjectTest.mm FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterDartProject_Internal.h -FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterDartVMServicePublisher.h -FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterDartVMServicePublisher.mm FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterEmbedderKeyResponder.h FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterEmbedderKeyResponder.mm FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterEmbedderKeyResponderTest.mm @@ -5018,6 +5016,8 @@ FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterKeySeco FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterKeyboardManager.h FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterKeyboardManager.mm FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterKeyboardManagerTest.mm +FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterObservatoryPublisher.h +FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterObservatoryPublisher.mm FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterOverlayView.h FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterOverlayView.mm FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterPlatformPlugin.h diff --git a/common/settings.h b/common/settings.h index 75f1e262fb0eb..39017dbc1cd40 100644 --- a/common/settings.h +++ b/common/settings.h @@ -161,23 +161,23 @@ struct Settings { // Platform.executable from dart:io. If unknown, defaults to "Flutter". std::string executable_name = "Flutter"; - // VM Service settings + // Observatory settings // Whether the Dart VM service should be enabled. - bool enable_vm_service = false; + bool enable_observatory = false; - // Whether to publish the VM Service URL over mDNS. + // Whether to publish the observatory URL over mDNS. // On iOS 14 this prompts a local network permission dialog, // which cannot be accepted or dismissed in a CI environment. - bool enable_vm_service_publication = true; + bool enable_observatory_publication = true; // The IP address to which the Dart VM service is bound. - std::string vm_service_host; + std::string observatory_host; // The port to which the Dart VM service is bound. When set to `0`, a free // port will be automatically selected by the OS. A message is logged on the // target indicating the URL at which the VM service can be accessed. - uint32_t vm_service_port = 0; + uint32_t observatory_port = 0; // Determines whether an authentication code is required to communicate with // the VM service. diff --git a/lib/web_ui/dev/browser.dart b/lib/web_ui/dev/browser.dart index b4e7d2383e833..fda2bb9ca3281 100644 --- a/lib/web_ui/dev/browser.dart +++ b/lib/web_ui/dev/browser.dart @@ -54,11 +54,11 @@ abstract class BrowserEnvironment { /// Any errors starting or running the browser process are reported through /// [onExit]. abstract class Browser { - /// The Dart VM Service URL for this browser. + /// The Observatory URL for this browser. /// /// Returns `null` for browsers that aren't running the Dart VM, or - /// if the Dart VM Service URL can't be found. - Future? get vmServiceUrl => null; + /// if the Observatory URL can't be found. + Future? get observatoryUrl => null; /// The remote debugger URL for this browser. /// diff --git a/lib/web_ui/dev/test_platform.dart b/lib/web_ui/dev/test_platform.dart index 17a66d0eff1fc..007670b78b0b6 100644 --- a/lib/web_ui/dev/test_platform.dart +++ b/lib/web_ui/dev/test_platform.dart @@ -820,7 +820,7 @@ class BrowserManager { /// Loads [_BrowserEnvironment]. Future<_BrowserEnvironment> _loadBrowserEnvironment() async { - return _BrowserEnvironment(this, await _browser.vmServiceUrl, + return _BrowserEnvironment(this, await _browser.observatoryUrl, await _browser.remoteDebuggerUrl, _onRestartController.stream); } diff --git a/runtime/dart_isolate.cc b/runtime/dart_isolate.cc index 6e4e3757cefc6..0f819ef9981c1 100644 --- a/runtime/dart_isolate.cc +++ b/runtime/dart_isolate.cc @@ -412,7 +412,7 @@ void DartIsolate::SetMessageHandlingTaskRunner( } // Updating thread names here does not change the underlying OS thread names. -// Instead, this is just additional metadata for the Dart VM Service to show the +// Instead, this is just additional metadata for the Observatory to show the // thread name of the isolate. bool DartIsolate::UpdateThreadPoolNames() const { // TODO(chinmaygarde): This implementation does not account for multiple @@ -766,7 +766,7 @@ Dart_Isolate DartIsolate::DartCreateAndStartServiceIsolate( const auto& settings = vm_data->GetSettings(); - if (!settings.enable_vm_service) { + if (!settings.enable_observatory) { return nullptr; } @@ -802,8 +802,8 @@ Dart_Isolate DartIsolate::DartCreateAndStartServiceIsolate( tonic::DartState::Scope scope(service_isolate); if (!DartServiceIsolate::Startup( - settings.vm_service_host, // server IP address - settings.vm_service_port, // server VM service port + settings.observatory_host, // server IP address + settings.observatory_port, // server observatory port tonic::DartState::HandleLibraryTag, // embedder library tag handler false, // disable websocket origin check settings.disable_service_auth_codes, // disable VM service auth codes diff --git a/runtime/dart_isolate_unittests.cc b/runtime/dart_isolate_unittests.cc index 2a299f3150c2f..e5f43fd56616a 100644 --- a/runtime/dart_isolate_unittests.cc +++ b/runtime/dart_isolate_unittests.cc @@ -404,9 +404,9 @@ TEST_F(DartIsolateTest, CanCreateServiceIsolate) { ASSERT_FALSE(DartVMRef::IsInstanceRunning()); fml::AutoResetWaitableEvent service_isolate_latch; auto settings = CreateSettingsForFixture(); - settings.enable_vm_service = true; - settings.vm_service_port = 0; - settings.vm_service_host = "127.0.0.1"; + settings.enable_observatory = true; + settings.observatory_port = 0; + settings.observatory_host = "127.0.0.1"; settings.enable_service_port_fallback = true; settings.service_isolate_create_callback = [&service_isolate_latch]() { service_isolate_latch.Signal(); diff --git a/runtime/dart_lifecycle_unittests.cc b/runtime/dart_lifecycle_unittests.cc index 467df37d273af..d3162905e3ae6 100644 --- a/runtime/dart_lifecycle_unittests.cc +++ b/runtime/dart_lifecycle_unittests.cc @@ -19,7 +19,7 @@ using DartLifecycleTest = FixtureTest; TEST_F(DartLifecycleTest, CanStartAndShutdownVM) { auto settings = CreateSettingsForFixture(); settings.leak_vm = false; - settings.enable_vm_service = false; + settings.enable_observatory = false; ASSERT_FALSE(DartVMRef::IsInstanceRunning()); { auto vm_ref = DartVMRef::Create(settings); @@ -31,7 +31,7 @@ TEST_F(DartLifecycleTest, CanStartAndShutdownVM) { TEST_F(DartLifecycleTest, CanStartAndShutdownVMOverAndOver) { auto settings = CreateSettingsForFixture(); settings.leak_vm = false; - settings.enable_vm_service = false; + settings.enable_observatory = false; ASSERT_FALSE(DartVMRef::IsInstanceRunning()); auto count = DartVM::GetVMLaunchCount(); for (size_t i = 0; i < 10; i++) { @@ -89,7 +89,7 @@ TEST_F(DartLifecycleTest, DISABLED_ShuttingDownTheVMShutsDownAllIsolates) { auto settings = CreateSettingsForFixture(); settings.leak_vm = false; // Make sure the service protocol launches - settings.enable_vm_service = true; + settings.enable_observatory = true; auto thread_task_runner = CreateNewThread(); diff --git a/runtime/dart_service_isolate.cc b/runtime/dart_service_isolate.cc index 9f27e16d323b9..18b51a32a6f1a 100644 --- a/runtime/dart_service_isolate.cc +++ b/runtime/dart_service_isolate.cc @@ -33,7 +33,7 @@ namespace { static Dart_LibraryTagHandler g_embedder_tag_handler; static tonic::DartLibraryNatives* g_natives; -static std::string g_vm_service_uri; +static std::string g_observatory_uri; Dart_NativeFunction GetNativeFunction(Dart_Handle name, int argument_count, @@ -51,7 +51,7 @@ const uint8_t* GetSymbol(Dart_NativeFunction native_function) { std::mutex DartServiceIsolate::callbacks_mutex_; -std::set> +std::set> DartServiceIsolate::callbacks_; void DartServiceIsolate::NotifyServerState(Dart_NativeArguments args) { @@ -63,11 +63,11 @@ void DartServiceIsolate::NotifyServerState(Dart_NativeArguments args) { return; } - g_vm_service_uri = uri; + g_observatory_uri = uri; // Collect callbacks to fire in a separate collection and invoke them outside // the lock. - std::vector + std::vector callbacks_to_fire; { std::scoped_lock lock(callbacks_mutex_); @@ -82,13 +82,13 @@ void DartServiceIsolate::NotifyServerState(Dart_NativeArguments args) { } DartServiceIsolate::CallbackHandle DartServiceIsolate::AddServerStatusCallback( - const DartServiceIsolate::DartVMServiceServerStateCallback& callback) { + const DartServiceIsolate::ObservatoryServerStateCallback& callback) { if (!callback) { return 0; } auto callback_pointer = - std::make_unique( + std::make_unique( callback); auto handle = reinterpret_cast(callback_pointer.get()); @@ -98,8 +98,8 @@ DartServiceIsolate::CallbackHandle DartServiceIsolate::AddServerStatusCallback( callbacks_.insert(std::move(callback_pointer)); } - if (!g_vm_service_uri.empty()) { - callback(g_vm_service_uri); + if (!g_observatory_uri.empty()) { + callback(g_observatory_uri); } return handle; diff --git a/runtime/dart_service_isolate.h b/runtime/dart_service_isolate.h index 5078c28a78a83..754a963d13693 100644 --- a/runtime/dart_service_isolate.h +++ b/runtime/dart_service_isolate.h @@ -27,11 +27,11 @@ class DartServiceIsolate { using CallbackHandle = ptrdiff_t; //---------------------------------------------------------------------------- - /// A callback made by the Dart VM when the VM Service is ready. The argument - /// indicates the VM Service URI. + /// A callback made by the Dart VM when the observatory is ready. The argument + /// indicates the observatory URI. /// - using DartVMServiceServerStateCallback = - std::function; + using ObservatoryServerStateCallback = + std::function; //---------------------------------------------------------------------------- /// @brief Start the service isolate. This call may only be made in the @@ -68,19 +68,19 @@ class DartServiceIsolate { char** error); //---------------------------------------------------------------------------- - /// @brief Add a callback that will get invoked when the VM Service - /// starts up. If the VM Service has already started before this + /// @brief Add a callback that will get invoked when the observatory + /// starts up. If the observatory has already started before this /// call is made, the callback is invoked immediately. /// /// This method is thread safe. /// - /// @param[in] callback The callback with information about the VM Service. + /// @param[in] callback The callback with information about the observatory. /// /// @return A handle for the callback that can be used later in /// `RemoveServerStatusCallback`. /// [[nodiscard]] static CallbackHandle AddServerStatusCallback( - const DartVMServiceServerStateCallback& callback); + const ObservatoryServerStateCallback& callback); //---------------------------------------------------------------------------- /// @brief Removed a callback previously registered via @@ -101,7 +101,7 @@ class DartServiceIsolate { static void Shutdown(Dart_NativeArguments args); static std::mutex callbacks_mutex_; - static std::set> callbacks_; + static std::set> callbacks_; }; } // namespace flutter diff --git a/shell/common/switches.cc b/shell/common/switches.cc index 1aec89b79b170..1d518824aa819 100644 --- a/shell/common/switches.cc +++ b/shell/common/switches.cc @@ -235,55 +235,33 @@ Settings SettingsFromCommandLine(const fml::CommandLine& command_line) { settings.executable_name = command_line.argv0(); } - // Enable the VM Service - settings.enable_vm_service = - !command_line.HasOption(FlagForSwitch(Switch::DisableVMService)) && - // TODO(bkonyi): remove once flutter_tools no longer uses this option. - // See https://github.com/dart-lang/sdk/issues/50233 + // Enable Observatory + settings.enable_observatory = !command_line.HasOption(FlagForSwitch(Switch::DisableObservatory)); - // Enable mDNS VM Service Publication - settings.enable_vm_service_publication = - !command_line.HasOption( - FlagForSwitch(Switch::DisableVMServicePublication)) && - !command_line.HasOption( - FlagForSwitch(Switch::DisableObservatoryPublication)); - - // Set VM Service Host - if (command_line.HasOption(FlagForSwitch(Switch::DeviceVMServiceHost))) { - command_line.GetOptionValue(FlagForSwitch(Switch::DeviceVMServiceHost), - &settings.vm_service_host); - } else if (command_line.HasOption( - FlagForSwitch(Switch::DeviceObservatoryHost))) { - // TODO(bkonyi): remove once flutter_tools no longer uses this option. - // See https://github.com/dart-lang/sdk/issues/50233 + // Enable mDNS Observatory Publication + settings.enable_observatory_publication = !command_line.HasOption( + FlagForSwitch(Switch::DisableObservatoryPublication)); + + // Set Observatory Host + if (command_line.HasOption(FlagForSwitch(Switch::DeviceObservatoryHost))) { command_line.GetOptionValue(FlagForSwitch(Switch::DeviceObservatoryHost), - &settings.vm_service_host); + &settings.observatory_host); } - // Default the VM Service port based on --ipv6 if not set. - if (settings.vm_service_host.empty()) { - settings.vm_service_host = + // Default the observatory port based on --ipv6 if not set. + if (settings.observatory_host.empty()) { + settings.observatory_host = command_line.HasOption(FlagForSwitch(Switch::IPv6)) ? "::1" : "127.0.0.1"; } - // Set VM Service Port - if (command_line.HasOption(FlagForSwitch(Switch::DeviceVMServicePort))) { - if (!GetSwitchValue(command_line, Switch::DeviceVMServicePort, - &settings.vm_service_port)) { - FML_LOG(INFO) - << "VM Service port specified was malformed. Will default to " - << settings.vm_service_port; - } - } else if (command_line.HasOption( - FlagForSwitch(Switch::DeviceObservatoryPort))) { - // TODO(bkonyi): remove once flutter_tools no longer uses this option. - // See https://github.com/dart-lang/sdk/issues/50233 + // Set Observatory Port + if (command_line.HasOption(FlagForSwitch(Switch::DeviceObservatoryPort))) { if (!GetSwitchValue(command_line, Switch::DeviceObservatoryPort, - &settings.vm_service_port)) { + &settings.observatory_port)) { FML_LOG(INFO) - << "VM Service port specified was malformed. Will default to " - << settings.vm_service_port; + << "Observatory port specified was malformed. Will default to " + << settings.observatory_port; } } diff --git a/shell/common/switches.h b/shell/common/switches.h index ce27a02e0fa01..a6512908cebe4 100644 --- a/shell/common/switches.h +++ b/shell/common/switches.h @@ -70,58 +70,30 @@ DEF_SWITCH(DartFlags, "dart-flags", "Flags passed directly to the Dart VM without being interpreted " "by the Flutter shell.") -DEF_SWITCH(DeviceVMServiceHost, - "vm-service-host", - "The hostname/IP address on which the Dart VM Service should " +DEF_SWITCH(DeviceObservatoryHost, + "observatory-host", + "The hostname/IP address on which the Dart Observatory should " "be served. If not set, defaults to 127.0.0.1 or ::1 depending on " "whether --ipv6 is specified.") -// TODO(bkonyi): remove once flutter_tools no longer uses this option. -// See https://github.com/dart-lang/sdk/issues/50233 -DEF_SWITCH( - DeviceObservatoryHost, - "observatory-host", - "(deprecated) The hostname/IP address on which the Dart VM Service should " - "be served. If not set, defaults to 127.0.0.1 or ::1 depending on " - "whether --ipv6 is specified.") -DEF_SWITCH(DeviceVMServicePort, - "vm-service-port", - "A custom Dart VM Service port. The default is to pick a randomly " - "available open port.") -// TODO(bkonyi): remove once flutter_tools no longer uses this option. -// See https://github.com/dart-lang/sdk/issues/50233 DEF_SWITCH(DeviceObservatoryPort, "observatory-port", - "(deprecated) A custom Dart VM Service port. The default is to pick " - "a randomly " + "A custom Dart Observatory port. The default is to pick a randomly " "available open port.") -DEF_SWITCH( - DisableVMService, - "disable-vm-service", - "Disable the Dart VM Service. The Dart VM Service is never available " - "in release mode.") -// TODO(bkonyi): remove once flutter_tools no longer uses this option. -// See https://github.com/dart-lang/sdk/issues/50233 DEF_SWITCH(DisableObservatory, "disable-observatory", - "(deprecated) Disable the Dart VM Service. The Dart VM Service is " - "never available " + "Disable the Dart Observatory. The observatory is never available " "in release mode.") -DEF_SWITCH(DisableVMServicePublication, - "disable-vm-service-publication", - "Disable mDNS Dart VM Service publication.") -// TODO(bkonyi): remove once flutter_tools no longer uses this option. -// See https://github.com/dart-lang/sdk/issues/50233 DEF_SWITCH(DisableObservatoryPublication, "disable-observatory-publication", - "(deprecated) Disable mDNS Dart VM Service publication.") + "Disable mDNS Dart Observatory publication.") DEF_SWITCH(IPv6, "ipv6", - "Bind to the IPv6 localhost address for the Dart VM Service. " - "Ignored if --vm-service-host is set.") + "Bind to the IPv6 localhost address for the Dart Observatory. " + "Ignored if --observatory-host is set.") DEF_SWITCH(EnableDartProfiling, "enable-dart-profiling", "Enable Dart profiling. Profiling information can be viewed from " - "Dart / Flutter DevTools.") + "the observatory.") DEF_SWITCH(EndlessTraceBuffer, "endless-trace-buffer", "Enable an endless trace buffer. The default is a ring buffer. " diff --git a/shell/platform/android/flutter_main.cc b/shell/platform/android/flutter_main.cc index 782b373c21d24..bf4930b1f1082 100644 --- a/shell/platform/android/flutter_main.cc +++ b/shell/platform/android/flutter_main.cc @@ -59,7 +59,7 @@ fml::jni::ScopedJavaGlobalRef* g_flutter_jni_class = nullptr; } // anonymous namespace FlutterMain::FlutterMain(const flutter::Settings& settings) - : settings_(settings), vm_service_uri_callback_() {} + : settings_(settings), observatory_uri_callback_() {} FlutterMain::~FlutterMain() = default; @@ -100,8 +100,8 @@ void FlutterMain::Init(JNIEnv* env, __android_log_print( ANDROID_LOG_INFO, "Flutter", "ATrace was enabled at startup. Flutter and Dart " - "tracing will be forwarded to systrace and will not show up in " - "Dart DevTools."); + "tracing will be forwarded to systrace and will not show up in the " + "Observatory timeline or Dart DevTools."); } } @@ -164,17 +164,17 @@ void FlutterMain::Init(JNIEnv* env, // longer be a singleton. g_flutter_main.reset(new FlutterMain(settings)); - g_flutter_main->SetupDartVMServiceUriCallback(env); + g_flutter_main->SetupObservatoryUriCallback(env); } -void FlutterMain::SetupDartVMServiceUriCallback(JNIEnv* env) { +void FlutterMain::SetupObservatoryUriCallback(JNIEnv* env) { g_flutter_jni_class = new fml::jni::ScopedJavaGlobalRef( env, env->FindClass("io/flutter/embedding/engine/FlutterJNI")); if (g_flutter_jni_class->is_null()) { return; } jfieldID uri_field = env->GetStaticFieldID( - g_flutter_jni_class->obj(), "vmServiceUri", "Ljava/lang/String;"); + g_flutter_jni_class->obj(), "observatoryUri", "Ljava/lang/String;"); if (uri_field == nullptr) { return; } @@ -190,7 +190,7 @@ void FlutterMain::SetupDartVMServiceUriCallback(JNIEnv* env) { fml::RefPtr platform_runner = fml::MessageLoop::GetCurrent().GetTaskRunner(); - vm_service_uri_callback_ = DartServiceIsolate::AddServerStatusCallback( + observatory_uri_callback_ = DartServiceIsolate::AddServerStatusCallback( [platform_runner, set_uri](const std::string& uri) { platform_runner->PostTask([uri, set_uri] { set_uri(uri); }); }); diff --git a/shell/platform/android/flutter_main.h b/shell/platform/android/flutter_main.h index bc78efce2d46a..b956377c8e295 100644 --- a/shell/platform/android/flutter_main.h +++ b/shell/platform/android/flutter_main.h @@ -25,7 +25,7 @@ class FlutterMain { private: const flutter::Settings settings_; - DartServiceIsolate::CallbackHandle vm_service_uri_callback_; + DartServiceIsolate::CallbackHandle observatory_uri_callback_; explicit FlutterMain(const flutter::Settings& settings); @@ -38,7 +38,7 @@ class FlutterMain { jstring engineCachesPath, jlong initTimeMillis); - void SetupDartVMServiceUriCallback(JNIEnv* env); + void SetupObservatoryUriCallback(JNIEnv* env); FML_DISALLOW_COPY_AND_ASSIGN(FlutterMain); }; diff --git a/shell/platform/android/io/flutter/app/FlutterActivityDelegate.java b/shell/platform/android/io/flutter/app/FlutterActivityDelegate.java index 4d77ee98febfb..0fe692c49c6c7 100644 --- a/shell/platform/android/io/flutter/app/FlutterActivityDelegate.java +++ b/shell/platform/android/io/flutter/app/FlutterActivityDelegate.java @@ -321,16 +321,9 @@ private static String[] getArgsFromIntent(Intent intent) { if (intent.getBooleanExtra("verbose-logging", false)) { args.add("--verbose-logging"); } - int vmServicePort = intent.getIntExtra("vm-service-port", 0); - if (vmServicePort > 0) { - args.add("--vm-service-port=" + Integer.toString(vmServicePort)); - } else { - // TODO(bkonyi): remove once flutter_tools no longer uses this option. - // See https://github.com/dart-lang/sdk/issues/50233 - vmServicePort = intent.getIntExtra("observatory-port", 0); - if (vmServicePort > 0) { - args.add("--vm-service-port=" + Integer.toString(vmServicePort)); - } + final int observatoryPort = intent.getIntExtra("observatory-port", 0); + if (observatoryPort > 0) { + args.add("--observatory-port=" + Integer.toString(observatoryPort)); } if (intent.getBooleanExtra("endless-trace-buffer", false)) { args.add("--endless-trace-buffer"); diff --git a/shell/platform/android/io/flutter/embedding/engine/FlutterJNI.java b/shell/platform/android/io/flutter/embedding/engine/FlutterJNI.java index 11eb88ae0b2a1..aba6f671deb5d 100644 --- a/shell/platform/android/io/flutter/embedding/engine/FlutterJNI.java +++ b/shell/platform/android/io/flutter/embedding/engine/FlutterJNI.java @@ -215,7 +215,7 @@ public void init( private static float refreshRateFPS = 60.0f; // This is set from native code via JNI. - @Nullable private static String vmServiceUri; + @Nullable private static String observatoryUri; private native boolean nativeGetIsSoftwareRenderingEnabled(); @@ -230,14 +230,14 @@ public boolean getIsSoftwareRenderingEnabled() { } /** - * VM Service URI for the VM instance. + * Observatory URI for the VM instance. * *

Its value is set by the native engine once {@link #init(Context, String[], String, String, * String, long)} is run. */ @Nullable - public static String getVMServiceUri() { - return vmServiceUri; + public static String getObservatoryUri() { + return observatoryUri; } /** diff --git a/shell/platform/android/io/flutter/embedding/engine/FlutterShellArgs.java b/shell/platform/android/io/flutter/embedding/engine/FlutterShellArgs.java index 5ab4ee2d2b68f..83c522421ce41 100644 --- a/shell/platform/android/io/flutter/embedding/engine/FlutterShellArgs.java +++ b/shell/platform/android/io/flutter/embedding/engine/FlutterShellArgs.java @@ -54,11 +54,8 @@ public class FlutterShellArgs { public static final String ARG_PURGE_PERSISTENT_CACHE = "--purge-persistent-cache"; public static final String ARG_KEY_VERBOSE_LOGGING = "verbose-logging"; public static final String ARG_VERBOSE_LOGGING = "--verbose-logging"; - public static final String ARG_KEY_VM_SERVICE_PORT = "vm-service-port"; - public static final String ARG_VM_SERVICE_PORT = "--vm-service-port="; - // TODO(bkonyi): remove once flutter_tools no longer uses this option. - // See https://github.com/dart-lang/sdk/issues/50233 public static final String ARG_KEY_OBSERVATORY_PORT = "observatory-port"; + public static final String ARG_OBSERVATORY_PORT = "--observatory-port="; public static final String ARG_KEY_DART_FLAGS = "dart-flags"; public static final String ARG_DART_FLAGS = "--dart-flags"; public static final String ARG_KEY_MSAA_SAMPLES = "msaa-samples"; @@ -79,16 +76,9 @@ public static FlutterShellArgs fromIntent(@NonNull Intent intent) { if (intent.getBooleanExtra(ARG_KEY_START_PAUSED, false)) { args.add(ARG_START_PAUSED); } - int vmServicePort = intent.getIntExtra(ARG_KEY_VM_SERVICE_PORT, 0); - if (vmServicePort > 0) { - args.add(ARG_VM_SERVICE_PORT + Integer.toString(vmServicePort)); - } else { - // TODO(bkonyi): remove once flutter_tools no longer uses this option. - // See https://github.com/dart-lang/sdk/issues/50233 - vmServicePort = intent.getIntExtra(ARG_KEY_OBSERVATORY_PORT, 0); - if (vmServicePort > 0) { - args.add(ARG_VM_SERVICE_PORT + Integer.toString(vmServicePort)); - } + final int observatoryPort = intent.getIntExtra(ARG_KEY_OBSERVATORY_PORT, 0); + if (observatoryPort > 0) { + args.add(ARG_OBSERVATORY_PORT + Integer.toString(observatoryPort)); } if (intent.getBooleanExtra(ARG_KEY_DISABLE_SERVICE_AUTH_CODES, false)) { args.add(ARG_DISABLE_SERVICE_AUTH_CODES); diff --git a/shell/platform/android/io/flutter/view/FlutterNativeView.java b/shell/platform/android/io/flutter/view/FlutterNativeView.java index 8f4c2086879f4..190a9ecbb160e 100644 --- a/shell/platform/android/io/flutter/view/FlutterNativeView.java +++ b/shell/platform/android/io/flutter/view/FlutterNativeView.java @@ -124,8 +124,8 @@ public boolean isApplicationRunning() { return applicationIsRunning; } - public static String getVMServiceUri() { - return FlutterJNI.getVMServiceUri(); + public static String getObservatoryUri() { + return FlutterJNI.getObservatoryUri(); } @Override diff --git a/shell/platform/darwin/ios/BUILD.gn b/shell/platform/darwin/ios/BUILD.gn index 9838c341cf9c2..8492a1475e517 100644 --- a/shell/platform/darwin/ios/BUILD.gn +++ b/shell/platform/darwin/ios/BUILD.gn @@ -80,8 +80,6 @@ source_set("flutter_framework_source") { "framework/Source/FlutterChannelKeyResponder.mm", "framework/Source/FlutterDartProject.mm", "framework/Source/FlutterDartProject_Internal.h", - "framework/Source/FlutterDartVMServicePublisher.h", - "framework/Source/FlutterDartVMServicePublisher.mm", "framework/Source/FlutterEmbedderKeyResponder.h", "framework/Source/FlutterEmbedderKeyResponder.mm", "framework/Source/FlutterEngine.mm", @@ -92,6 +90,8 @@ source_set("flutter_framework_source") { "framework/Source/FlutterKeySecondaryResponder.h", "framework/Source/FlutterKeyboardManager.h", "framework/Source/FlutterKeyboardManager.mm", + "framework/Source/FlutterObservatoryPublisher.h", + "framework/Source/FlutterObservatoryPublisher.mm", "framework/Source/FlutterOverlayView.h", "framework/Source/FlutterOverlayView.mm", "framework/Source/FlutterPlatformPlugin.h", diff --git a/shell/platform/darwin/ios/framework/Headers/FlutterEngine.h b/shell/platform/darwin/ios/framework/Headers/FlutterEngine.h index 02f3327d48a0b..57ac4c22d34bf 100644 --- a/shell/platform/darwin/ios/framework/Headers/FlutterEngine.h +++ b/shell/platform/darwin/ios/framework/Headers/FlutterEngine.h @@ -410,13 +410,13 @@ FLUTTER_DARWIN_EXPORT @property(nonatomic, readonly) FlutterBasicMessageChannel* keyEventChannel; /** - * The `NSURL` of the Dart VM Service for the service isolate. + * The `NSURL` of the observatory for the service isolate. * * This is only set in debug and profile runtime modes, and only after the - * Dart VM Service is ready. In release mode or before the Dart VM Service has + * observatory service is ready. In release mode or before the observatory has * started, it returns `nil`. */ -@property(nonatomic, readonly, nullable) NSURL* vmServiceUrl; +@property(nonatomic, readonly, nullable) NSURL* observatoryUrl; /** * The `FlutterBinaryMessenger` associated with this FlutterEngine (used for communicating with diff --git a/shell/platform/darwin/ios/framework/Source/FlutterEngine.mm b/shell/platform/darwin/ios/framework/Source/FlutterEngine.mm index 4765e78ab8b72..480b284678614 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterEngine.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterEngine.mm @@ -21,8 +21,8 @@ #import "flutter/shell/platform/darwin/common/command_line.h" #import "flutter/shell/platform/darwin/ios/framework/Source/FlutterBinaryMessengerRelay.h" #import "flutter/shell/platform/darwin/ios/framework/Source/FlutterDartProject_Internal.h" -#import "flutter/shell/platform/darwin/ios/framework/Source/FlutterDartVMServicePublisher.h" #import "flutter/shell/platform/darwin/ios/framework/Source/FlutterIndirectScribbleDelegate.h" +#import "flutter/shell/platform/darwin/ios/framework/Source/FlutterObservatoryPublisher.h" #import "flutter/shell/platform/darwin/ios/framework/Source/FlutterPlatformPlugin.h" #import "flutter/shell/platform/darwin/ios/framework/Source/FlutterSpellCheckPlugin.h" #import "flutter/shell/platform/darwin/ios/framework/Source/FlutterTextInputDelegate.h" @@ -108,7 +108,7 @@ @implementation FlutterEngine { std::unique_ptr> _weakFactory; fml::WeakPtr _viewController; - fml::scoped_nsobject _publisher; + fml::scoped_nsobject _publisher; std::shared_ptr _platformViewsController; flutter::IOSRenderingAPI _renderingApi; @@ -498,7 +498,7 @@ - (FlutterBasicMessageChannel*)keyEventChannel { return _keyEventChannel.get(); } -- (NSURL*)vmServiceUrl { +- (NSURL*)observatoryUrl { return [_publisher.get() url]; } @@ -680,13 +680,13 @@ - (void)launchEngine:(NSString*)entrypoint } - (void)setupShell:(std::unique_ptr)shell - withVMServicePublication:(BOOL)doesVMServicePublication { + withObservatoryPublication:(BOOL)doesObservatoryPublication { _shell = std::move(shell); [self setupChannels]; [self onLocaleUpdated:nil]; [self initializeDisplays]; - _publisher.reset([[FlutterDartVMServicePublisher alloc] - initWithEnableVMServicePublication:doesVMServicePublication]); + _publisher.reset([[FlutterObservatoryPublisher alloc] + initWithEnableObservatoryPublication:doesObservatoryPublication]); [self maybeSetupPlatformViewChannels]; _shell->SetGpuAvailability(_isGpuDisabled ? flutter::GpuAvailability::kUnavailable : flutter::GpuAvailability::kAvailable); @@ -816,7 +816,7 @@ - (BOOL)createShell:(NSString*)entrypoint << entrypoint.UTF8String; } else { [self setupShell:std::move(shell) - withVMServicePublication:settings.enable_vm_service_publication]; + withObservatoryPublication:settings.enable_observatory_publication]; if ([FlutterEngine isProfilerEnabled]) { [self startProfiler]; } @@ -1312,7 +1312,7 @@ - (FlutterEngine*)spawnWithEntrypoint:(/*nullable*/ NSString*)entrypoint result->_profiler = _profiler; result->_profiler_metrics = _profiler_metrics; result->_isGpuDisabled = _isGpuDisabled; - [result setupShell:std::move(shell) withVMServicePublication:NO]; + [result setupShell:std::move(shell) withObservatoryPublication:NO]; return [result autorelease]; } diff --git a/shell/platform/darwin/ios/framework/Source/FlutterDartVMServicePublisher.h b/shell/platform/darwin/ios/framework/Source/FlutterObservatoryPublisher.h similarity index 56% rename from shell/platform/darwin/ios/framework/Source/FlutterDartVMServicePublisher.h rename to shell/platform/darwin/ios/framework/Source/FlutterObservatoryPublisher.h index 398e9f09e5a92..0c3fe202c6116 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterDartVMServicePublisher.h +++ b/shell/platform/darwin/ios/framework/Source/FlutterObservatoryPublisher.h @@ -2,14 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef FLUTTER_FLUTTERDARTVMSERVICEPUBLISHER_H_ -#define FLUTTER_FLUTTERDARTVMSERVICEPUBLISHER_H_ +#ifndef FLUTTER_FLUTTEROBSERVATORYPUBLISHER_H_ +#define FLUTTER_FLUTTEROBSERVATORYPUBLISHER_H_ #import -@interface FlutterDartVMServicePublisher : NSObject +@interface FlutterObservatoryPublisher : NSObject -- (instancetype)initWithEnableVMServicePublication:(BOOL)enableVMServicePublication +- (instancetype)initWithEnableObservatoryPublication:(BOOL)enableObservatoryPublication NS_DESIGNATED_INITIALIZER; - (instancetype)init NS_UNAVAILABLE; + (instancetype)new NS_UNAVAILABLE; @@ -18,4 +18,4 @@ @end -#endif // FLUTTER_FLUTTERDARTVMSERVICEPUBLISHER_H_ +#endif // FLUTTER_FLUTTEROBSERVATORYPUBLISHER_H_ diff --git a/shell/platform/darwin/ios/framework/Source/FlutterDartVMServicePublisher.mm b/shell/platform/darwin/ios/framework/Source/FlutterObservatoryPublisher.mm similarity index 62% rename from shell/platform/darwin/ios/framework/Source/FlutterDartVMServicePublisher.mm rename to shell/platform/darwin/ios/framework/Source/FlutterObservatoryPublisher.mm index 1fb4e7b14d147..9b3c437856c6f 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterDartVMServicePublisher.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterObservatoryPublisher.mm @@ -4,12 +4,12 @@ #define FML_USED_ON_EMBEDDER -#import "FlutterDartVMServicePublisher.h" +#import "FlutterObservatoryPublisher.h" #if FLUTTER_RELEASE -@implementation FlutterDartVMServicePublisher -- (instancetype)initWithEnableVMServicePublication:(BOOL)enableVMServicePublication { +@implementation FlutterObservatoryPublisher +- (instancetype)initWithEnableObservatoryPublication:(BOOL)enableObservatoryPublication { return [super init]; } @end @@ -23,9 +23,9 @@ - (instancetype)initWithEnableVMServicePublication:(BOOL)enableVMServicePublicat // // When debugging issues with this implementation, the following is helpful: // -// 1) Running `dns-sd -Z _dartVmService`. This is a built-in macOS tool that +// 1) Running `dns-sd -Z _dartobservatory`. This is a built-in macOS tool that // can find advertized observatories using this method. If dns-sd can't find -// it, then the VM service is not getting advertised over any network +// it, then the observatory is not getting advertized over any network // interface that the host machine has access to. // 2) The Python zeroconf package. The dns-sd tool can sometimes see things // that aren't advertizing over a network interface - for example, simulators @@ -45,27 +45,26 @@ - (instancetype)initWithEnableVMServicePublication:(BOOL)enableVMServicePublicat #include "flutter/fml/platform/darwin/scoped_nsobject.h" #include "flutter/runtime/dart_service_isolate.h" -@protocol FlutterDartVMServicePublisherDelegate +@protocol FlutterObservatoryPublisherDelegate - (void)publishServiceProtocolPort:(NSURL*)uri; - (void)stopService; @end -@interface FlutterDartVMServicePublisher () +@interface FlutterObservatoryPublisher () + (NSData*)createTxtData:(NSURL*)url; @property(readonly, class) NSString* serviceName; -@property(readonly) fml::scoped_nsobject> delegate; +@property(readonly) fml::scoped_nsobject> delegate; @property(nonatomic, readwrite) NSURL* url; -@property(readonly) BOOL enableVMServicePublication; +@property(readonly) BOOL enableObservatoryPublication; @end -@interface DartVMServiceDNSServiceDelegate : NSObject +@interface ObservatoryDNSServiceDelegate : NSObject @end -@implementation DartVMServiceDNSServiceDelegate { +@implementation ObservatoryDNSServiceDelegate { DNSServiceRef _dnsServiceRef; - DNSServiceRef _legacyDnsServiceRef; } - (void)stopService { @@ -73,10 +72,6 @@ - (void)stopService { DNSServiceRefDeallocate(_dnsServiceRef); _dnsServiceRef = NULL; } - if (_legacyDnsServiceRef) { - DNSServiceRefDeallocate(_legacyDnsServiceRef); - _legacyDnsServiceRef = NULL; - } } - (void)publishServiceProtocolPort:(NSURL*)url { @@ -88,20 +83,18 @@ - (void)publishServiceProtocolPort:(NSURL*)url { // Physical devices need to request all interfaces. uint32_t interfaceIndex = 0; #endif // TARGET_IPHONE_SIMULATOR - const char* registrationType = "_dartVmService._tcp"; - const char* legacyRegistrationType = "_dartobservatory._tcp"; - + const char* registrationType = "_dartobservatory._tcp"; const char* domain = "local."; // default domain uint16_t port = [[url port] unsignedShortValue]; - NSData* txtData = [FlutterDartVMServicePublisher createTxtData:url]; + NSData* txtData = [FlutterObservatoryPublisher createTxtData:url]; int err = DNSServiceRegister(&_dnsServiceRef, flags, interfaceIndex, - FlutterDartVMServicePublisher.serviceName.UTF8String, - registrationType, domain, NULL, htons(port), txtData.length, - txtData.bytes, RegistrationCallback, NULL); + FlutterObservatoryPublisher.serviceName.UTF8String, registrationType, + domain, NULL, htons(port), txtData.length, txtData.bytes, + RegistrationCallback, NULL); if (err != 0) { - FML_LOG(ERROR) << "Failed to register Dart VM Service port with mDNS with error " << err << "."; + FML_LOG(ERROR) << "Failed to register observatory port with mDNS with error " << err << "."; if (@available(iOS 14.0, *)) { FML_LOG(ERROR) << "On iOS 14+, local network broadcast in apps need to be declared in " << "the app's Info.plist. Debug and profile Flutter apps and modules host " @@ -117,31 +110,6 @@ - (void)publishServiceProtocolPort:(NSURL*)url { } else { DNSServiceSetDispatchQueue(_dnsServiceRef, dispatch_get_main_queue()); } - - // TODO(bkonyi): remove once flutter_tools no longer looks for the legacy registration type. - // See https://github.com/dart-lang/sdk/issues/50233 - err = DNSServiceRegister(&_legacyDnsServiceRef, flags, interfaceIndex, - FlutterDartVMServicePublisher.serviceName.UTF8String, - legacyRegistrationType, domain, NULL, htons(port), txtData.length, - txtData.bytes, RegistrationCallback, NULL); - - if (err != 0) { - FML_LOG(ERROR) << "Failed to register Dart VM Service port with mDNS with error " << err << "."; - if (@available(iOS 14.0, *)) { - FML_LOG(ERROR) << "On iOS 14+, local network broadcast in apps need to be declared in " - << "the app's Info.plist. Debug and profile Flutter apps and modules host " - << "VM services on the local network to support debugging features such " - << "as hot reload and DevTools. To make your Flutter app or module " - << "attachable and debuggable, add a '" << legacyRegistrationType << "' value " - << "to the 'NSBonjourServices' key in your Info.plist for the Debug/" - << "Profile configurations. " - << "For more information, see " - << "https://flutter.dev/docs/development/add-to-app/ios/" - "project-setup#local-network-privacy-permissions"; - } - } else { - DNSServiceSetDispatchQueue(_legacyDnsServiceRef, dispatch_get_main_queue()); - } } static void DNSSD_API RegistrationCallback(DNSServiceRef sdRef, @@ -152,32 +120,32 @@ static void DNSSD_API RegistrationCallback(DNSServiceRef sdRef, const char* domain, void* context) { if (errorCode == kDNSServiceErr_NoError) { - FML_DLOG(INFO) << "FlutterDartVMServicePublisher is ready!"; + FML_DLOG(INFO) << "FlutterObservatoryPublisher is ready!"; } else if (errorCode == kDNSServiceErr_PolicyDenied) { FML_LOG(ERROR) - << "Could not register as server for FlutterDartVMServicePublisher, permission " + << "Could not register as server for FlutterObservatoryPublisher, permission " << "denied. Check your 'Local Network' permissions for this app in the Privacy section of " << "the system Settings."; } else { - FML_LOG(ERROR) << "Could not register as server for FlutterDartVMServicePublisher. Check your " + FML_LOG(ERROR) << "Could not register as server for FlutterObservatoryPublisher. Check your " "network settings and relaunch the application."; } } @end -@implementation FlutterDartVMServicePublisher { +@implementation FlutterObservatoryPublisher { flutter::DartServiceIsolate::CallbackHandle _callbackHandle; - std::unique_ptr> _weakFactory; + std::unique_ptr> _weakFactory; } -- (instancetype)initWithEnableVMServicePublication:(BOOL)enableVMServicePublication { +- (instancetype)initWithEnableObservatoryPublication:(BOOL)enableObservatoryPublication { self = [super init]; NSAssert(self, @"Super must not return null on init."); - _delegate.reset([[DartVMServiceDNSServiceDelegate alloc] init]); - _enableVMServicePublication = enableVMServicePublication; - _weakFactory = std::make_unique>(self); + _delegate.reset([[ObservatoryDNSServiceDelegate alloc] init]); + _enableObservatoryPublication = enableObservatoryPublication; + _weakFactory = std::make_unique>(self); fml::MessageLoop::EnsureInitializedForCurrentThread(); @@ -192,7 +160,7 @@ - (instancetype)initWithEnableVMServicePublication:(BOOL)enableVMServicePublicat NSURL* url = [[[NSURL alloc] initWithString:[NSString stringWithUTF8String:uri.c_str()]] autorelease]; weak.get().url = url; - if (weak.get().enableVMServicePublication) { + if (weak.get().enableObservatoryPublication) { [[weak.get() delegate] publishServiceProtocolPort:url]; } } diff --git a/shell/platform/embedder/tests/embedder_config_builder.cc b/shell/platform/embedder/tests/embedder_config_builder.cc index 0cc772bdb002e..d61b5ffb63370 100644 --- a/shell/platform/embedder/tests/embedder_config_builder.cc +++ b/shell/platform/embedder/tests/embedder_config_builder.cc @@ -113,7 +113,7 @@ EmbedderConfigBuilder::EmbedderConfigBuilder( SetSemanticsCallbackHooks(); SetLogMessageCallbackHook(); SetLocalizationCallbackHooks(); - AddCommandLineArgument("--disable-vm-service"); + AddCommandLineArgument("--disable-observatory"); if (preference == InitializationPreference::kSnapshotsInitialize || preference == InitializationPreference::kMultiAOTInitialize) { diff --git a/shell/platform/fuchsia/dart_runner/service_isolate.cc b/shell/platform/fuchsia/dart_runner/service_isolate.cc index d331e96f44af6..6c7ca066c673b 100644 --- a/shell/platform/fuchsia/dart_runner/service_isolate.cc +++ b/shell/platform/fuchsia/dart_runner/service_isolate.cc @@ -209,17 +209,17 @@ Dart_Isolate CreateServiceIsolate( } // namespace dart_runner Dart_Handle GetVMServiceAssetsArchiveCallback() { - dart_utils::MappedResource vm_service_tar; + dart_utils::MappedResource observatory_tar; if (!dart_utils::MappedResource::LoadFromNamespace( - nullptr, "/pkg/data/observatory.tar", vm_service_tar)) { + nullptr, "/pkg/data/observatory.tar", observatory_tar)) { FX_LOG(ERROR, LOG_TAG, "Failed to load Observatory assets"); return nullptr; } // TODO(rmacnak): Should we avoid copying the tar? Or does the service // library not hold onto it anyway? return tonic::DartConverter::ToDart( - reinterpret_cast(vm_service_tar.address()), - vm_service_tar.size()); + reinterpret_cast(observatory_tar.address()), + observatory_tar.size()); } } // namespace dart_runner diff --git a/shell/platform/fuchsia/flutter/component_v1.cc b/shell/platform/fuchsia/flutter/component_v1.cc index 3f21401c361df..a024974c13b84 100644 --- a/shell/platform/fuchsia/flutter/component_v1.cc +++ b/shell/platform/fuchsia/flutter/component_v1.cc @@ -363,12 +363,12 @@ ComponentV1::ComponentV1( } #if defined(DART_PRODUCT) - settings_.enable_vm_service = false; + settings_.enable_observatory = false; #else - settings_.enable_vm_service = true; + settings_.enable_observatory = true; // TODO(cbracken): pass this in as a param to allow 0.0.0.0, ::1, etc. - settings_.vm_service_host = "127.0.0.1"; + settings_.observatory_host = "127.0.0.1"; #endif // Controls whether category "skia" trace events are enabled. diff --git a/shell/platform/fuchsia/flutter/component_v2.cc b/shell/platform/fuchsia/flutter/component_v2.cc index fdd577469d70b..93504818d8915 100644 --- a/shell/platform/fuchsia/flutter/component_v2.cc +++ b/shell/platform/fuchsia/flutter/component_v2.cc @@ -426,12 +426,12 @@ ComponentV2::ComponentV2( } #if defined(DART_PRODUCT) - settings_.enable_vm_service = false; + settings_.enable_observatory = false; #else - settings_.enable_vm_service = true; + settings_.enable_observatory = true; // TODO(cbracken): pass this in as a param to allow 0.0.0.0, ::1, etc. - settings_.vm_service_host = "127.0.0.1"; + settings_.observatory_host = "127.0.0.1"; #endif // Controls whether category "skia" trace events are enabled. diff --git a/shell/profiling/sampling_profiler.cc b/shell/profiling/sampling_profiler.cc index 4b5e8d44b7997..c6058b76cd4c7 100644 --- a/shell/profiling/sampling_profiler.cc +++ b/shell/profiling/sampling_profiler.cc @@ -33,7 +33,7 @@ void SamplingProfiler::Start() { << num_samples_per_sec_; double delay_between_samples = 1.0 / num_samples_per_sec_; auto task_delay = fml::TimeDelta::FromSecondsF(delay_between_samples); - UpdateDartVMServiceThreadName(); + UpdateObservatoryThreadName(); is_running_ = true; SampleRepeatedly(task_delay); } @@ -88,7 +88,7 @@ void SamplingProfiler::SampleRepeatedly(fml::TimeDelta task_delay) const { task_delay); } -void SamplingProfiler::UpdateDartVMServiceThreadName() const { +void SamplingProfiler::UpdateObservatoryThreadName() const { FML_CHECK(profiler_task_runner_); profiler_task_runner_->PostTask( diff --git a/shell/profiling/sampling_profiler.h b/shell/profiling/sampling_profiler.h index 1385613503494..d68f88a643d3e 100644 --- a/shell/profiling/sampling_profiler.h +++ b/shell/profiling/sampling_profiler.h @@ -76,7 +76,7 @@ using Sampler = std::function; * @brief a Sampling Profiler that runs peridically and calls the `Sampler` * which servers as a value function to gather various profiling metrics as * represented by `ProfileSample`. These profiling metrics are then posted to - * the Dart VM Service timeline. + * the observatory timeline. * */ class SamplingProfiler { @@ -84,7 +84,7 @@ class SamplingProfiler { /** * @brief Construct a new Sampling Profiler object * - * @param thread_label Dart VM Service prefix to be set for the profiling task + * @param thread_label observatory prefix to be set for the profiling task * runner. * @param profiler_task_runner the task runner to service sampling requests. * @param sampler the value function to collect the profiling metrics. @@ -121,10 +121,10 @@ class SamplingProfiler { /** * @brief This doesn't update the underlying OS thread name for the thread * backing `profiler_task_runner_`. Instead, this is just additional metadata - * for the VM Service to show the thread name of the isolate. + * for the Observatory to show the thread name of the isolate. * */ - void UpdateDartVMServiceThreadName() const; + void UpdateObservatoryThreadName() const; FML_DISALLOW_COPY_AND_ASSIGN(SamplingProfiler); }; diff --git a/shell/testing/observatory/launcher.dart b/shell/testing/observatory/launcher.dart index 0b4e91e3a5140..2603e359c4b0e 100644 --- a/shell/testing/observatory/launcher.dart +++ b/shell/testing/observatory/launcher.dart @@ -2,23 +2,25 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +library observatory_sky_shell_launcher; + import 'dart:async'; import 'dart:convert'; import 'dart:io'; class ShellProcess { - final Completer _vmServiceUriCompleter = Completer(); + final Completer _observatoryUriCompleter = Completer(); final Process _process; ShellProcess(this._process) { - // Scan stdout and scrape the VM Service Uri. + // Scan stdout and scrape the Observatory Uri. _process.stdout .transform(utf8.decoder) .transform(const LineSplitter()) .listen((String line) { final uri = _extractVMServiceUri(line); if (uri != null) { - _vmServiceUriCompleter.complete(uri); + _observatoryUriCompleter.complete(uri); } }); } @@ -27,13 +29,13 @@ class ShellProcess { return _process.kill(); } - Future waitForVMService() async { - return _vmServiceUriCompleter.future; + Future waitForObservatory() async { + return _observatoryUriCompleter.future; } Uri? _extractVMServiceUri(String str) { final listeningMessageRegExp = RegExp( - r'The Dart VM service is listening on ((http|//)[a-zA-Z0-9:/=_\-\.\[\]]+)', + r'(?:Observatory|The Dart VM service is) listening on ((http|//)[a-zA-Z0-9:/=_\-\.\[\]]+)', ); final match = listeningMessageRegExp.firstMatch(str); if (match != null) { @@ -45,7 +47,7 @@ class ShellProcess { class ShellLauncher { final List args = [ - '--vm-service-port=0', + '--observatory-port=0', '--non-interactive', '--run-forever', '--disable-service-auth-codes', diff --git a/shell/testing/observatory/service_client.dart b/shell/testing/observatory/service_client.dart index 8d52c6ef1ca27..160a17795468a 100644 --- a/shell/testing/observatory/service_client.dart +++ b/shell/testing/observatory/service_client.dart @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +library observatory_sky_shell_service_client; + import 'dart:async'; import 'dart:convert'; import 'dart:io'; diff --git a/shell/testing/observatory/test.dart b/shell/testing/observatory/test.dart index ad944dfb74210..a351c444e69d9 100644 --- a/shell/testing/observatory/test.dart +++ b/shell/testing/observatory/test.dart @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// This is a minimal dependency heart beat test for the Dart VM Service. +// This is a minimal dependency heart beat test for Observatory. import 'dart:async'; import 'dart:convert'; @@ -170,14 +170,14 @@ Future runTests(ShellLauncher launcher, List tests) async { if (process == null) { return false; } - final Uri uri = await process.waitForVMService(); + final Uri uri = await process.waitForObservatory(); try { for (int i = 0; i < tests.length; i++) { print('Executing test ${i + 1}/${tests.length}'); await tests[i](uri); } } catch (e, st) { - print('Dart VM Service test failure: $e\n$st'); + print('Observatory test failure: $e\n$st'); exitCode = -1; } await process.kill(); diff --git a/testing/dart/observatory/shader_reload_test.dart b/testing/dart/observatory/shader_reload_test.dart index ff2280ed271f0..ca4981e4b64fb 100644 --- a/testing/dart/observatory/shader_reload_test.dart +++ b/testing/dart/observatory/shader_reload_test.dart @@ -23,7 +23,7 @@ void main() { final developer.ServiceProtocolInfo info = await developer.Service.getInfo(); if (info.serverUri == null) { - fail('This test must not be run with --disable-vm-service.'); + fail('This test must not be run with --disable-observatory.'); } vmService = await vmServiceConnectUri( diff --git a/testing/dart/observatory/skp_test.dart b/testing/dart/observatory/skp_test.dart index 00c7235b2fb0a..0303702c7a3f5 100644 --- a/testing/dart/observatory/skp_test.dart +++ b/testing/dart/observatory/skp_test.dart @@ -17,7 +17,7 @@ void main() { final developer.ServiceProtocolInfo info = await developer.Service.getInfo(); if (info.serverUri == null) { - fail('This test must not be run with --disable-vm-service.'); + fail('This test must not be run with --disable-observatory.'); } final vms.VmService vmService = await vmServiceConnectUri( diff --git a/testing/dart/observatory/tracing_test.dart b/testing/dart/observatory/tracing_test.dart index 6f709bf64084e..3257a8ef06e3c 100644 --- a/testing/dart/observatory/tracing_test.dart +++ b/testing/dart/observatory/tracing_test.dart @@ -15,7 +15,7 @@ void main() { final developer.ServiceProtocolInfo info = await developer.Service.getInfo(); if (info.serverUri == null) { - fail('This test must not be run with --disable-vm-service.'); + fail('This test must not be run with --disable-observatory.'); } final vms.VmService vmService = await vmServiceConnectUri( diff --git a/testing/dart/observatory/vmservice_methods_test.dart b/testing/dart/observatory/vmservice_methods_test.dart index e74caac65b692..6fe14f0d5e697 100644 --- a/testing/dart/observatory/vmservice_methods_test.dart +++ b/testing/dart/observatory/vmservice_methods_test.dart @@ -18,7 +18,7 @@ void main() { try { final developer.ServiceProtocolInfo info = await developer.Service.getInfo(); if (info.serverUri == null) { - fail('This test must not be run with --disable-vm-service.'); + fail('This test must not be run with --disable-observatory.'); } vmService = await vmServiceConnectUri( @@ -47,7 +47,7 @@ void main() { try { final developer.ServiceProtocolInfo info = await developer.Service.getInfo(); if (info.serverUri == null) { - fail('This test must not be run with --disable-vm-service.'); + fail('This test must not be run with --disable-observatory.'); } vmService = await vmServiceConnectUri( @@ -71,7 +71,7 @@ void main() { final developer.ServiceProtocolInfo info = await developer.Service.getInfo(); if (info.serverUri == null) { - fail('This test must not be run with --disable-vm-service.'); + fail('This test must not be run with --disable-observatory.'); } final Completer completer = Completer(); diff --git a/testing/dart_fixture.cc b/testing/dart_fixture.cc index 7c765dcb105a5..9fe8a5c5b0fc9 100644 --- a/testing/dart_fixture.cc +++ b/testing/dart_fixture.cc @@ -35,7 +35,7 @@ Settings DartFixture::CreateSettingsForFixture() { settings.isolate_create_callback = [this]() { native_resolver_->SetNativeResolverForIsolate(); }; - settings.enable_vm_service = false; + settings.enable_observatory = false; SetSnapshotsAndAssets(settings); return settings; }