Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 58eb106

Browse files
authored
Revert "Remove references to Observatory (#38919)" (#39035)
Reason for revert: breaking Flutter -> plugins roll This reverts commit 88e61d8.
1 parent d84b3dc commit 58eb106

36 files changed

+172
-267
lines changed

ci/licenses_golden/licenses_flutter

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2508,8 +2508,6 @@ ORIGIN: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterChann
25082508
ORIGIN: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterDartProject.mm + ../../../flutter/LICENSE
25092509
ORIGIN: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterDartProjectTest.mm + ../../../flutter/LICENSE
25102510
ORIGIN: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterDartProject_Internal.h + ../../../flutter/LICENSE
2511-
ORIGIN: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterDartVMServicePublisher.h + ../../../flutter/LICENSE
2512-
ORIGIN: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterDartVMServicePublisher.mm + ../../../flutter/LICENSE
25132511
ORIGIN: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterEmbedderKeyResponder.h + ../../../flutter/LICENSE
25142512
ORIGIN: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterEmbedderKeyResponder.mm + ../../../flutter/LICENSE
25152513
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
25302528
ORIGIN: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterKeyboardManager.h + ../../../flutter/LICENSE
25312529
ORIGIN: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterKeyboardManager.mm + ../../../flutter/LICENSE
25322530
ORIGIN: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterKeyboardManagerTest.mm + ../../../flutter/LICENSE
2531+
ORIGIN: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterObservatoryPublisher.h + ../../../flutter/LICENSE
2532+
ORIGIN: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterObservatoryPublisher.mm + ../../../flutter/LICENSE
25332533
ORIGIN: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterOverlayView.h + ../../../flutter/LICENSE
25342534
ORIGIN: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterOverlayView.mm + ../../../flutter/LICENSE
25352535
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
49964996
FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterDartProject.mm
49974997
FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterDartProjectTest.mm
49984998
FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterDartProject_Internal.h
4999-
FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterDartVMServicePublisher.h
5000-
FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterDartVMServicePublisher.mm
50014999
FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterEmbedderKeyResponder.h
50025000
FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterEmbedderKeyResponder.mm
50035001
FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterEmbedderKeyResponderTest.mm
@@ -5018,6 +5016,8 @@ FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterKeySeco
50185016
FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterKeyboardManager.h
50195017
FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterKeyboardManager.mm
50205018
FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterKeyboardManagerTest.mm
5019+
FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterObservatoryPublisher.h
5020+
FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterObservatoryPublisher.mm
50215021
FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterOverlayView.h
50225022
FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterOverlayView.mm
50235023
FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterPlatformPlugin.h

common/settings.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -161,23 +161,23 @@ struct Settings {
161161
// Platform.executable from dart:io. If unknown, defaults to "Flutter".
162162
std::string executable_name = "Flutter";
163163

164-
// VM Service settings
164+
// Observatory settings
165165

166166
// Whether the Dart VM service should be enabled.
167-
bool enable_vm_service = false;
167+
bool enable_observatory = false;
168168

169-
// Whether to publish the VM Service URL over mDNS.
169+
// Whether to publish the observatory URL over mDNS.
170170
// On iOS 14 this prompts a local network permission dialog,
171171
// which cannot be accepted or dismissed in a CI environment.
172-
bool enable_vm_service_publication = true;
172+
bool enable_observatory_publication = true;
173173

174174
// The IP address to which the Dart VM service is bound.
175-
std::string vm_service_host;
175+
std::string observatory_host;
176176

177177
// The port to which the Dart VM service is bound. When set to `0`, a free
178178
// port will be automatically selected by the OS. A message is logged on the
179179
// target indicating the URL at which the VM service can be accessed.
180-
uint32_t vm_service_port = 0;
180+
uint32_t observatory_port = 0;
181181

182182
// Determines whether an authentication code is required to communicate with
183183
// the VM service.

lib/web_ui/dev/browser.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,11 @@ abstract class BrowserEnvironment {
5454
/// Any errors starting or running the browser process are reported through
5555
/// [onExit].
5656
abstract class Browser {
57-
/// The Dart VM Service URL for this browser.
57+
/// The Observatory URL for this browser.
5858
///
5959
/// Returns `null` for browsers that aren't running the Dart VM, or
60-
/// if the Dart VM Service URL can't be found.
61-
Future<Uri>? get vmServiceUrl => null;
60+
/// if the Observatory URL can't be found.
61+
Future<Uri>? get observatoryUrl => null;
6262

6363
/// The remote debugger URL for this browser.
6464
///

lib/web_ui/dev/test_platform.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -820,7 +820,7 @@ class BrowserManager {
820820

821821
/// Loads [_BrowserEnvironment].
822822
Future<_BrowserEnvironment> _loadBrowserEnvironment() async {
823-
return _BrowserEnvironment(this, await _browser.vmServiceUrl,
823+
return _BrowserEnvironment(this, await _browser.observatoryUrl,
824824
await _browser.remoteDebuggerUrl, _onRestartController.stream);
825825
}
826826

runtime/dart_isolate.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ void DartIsolate::SetMessageHandlingTaskRunner(
412412
}
413413

414414
// Updating thread names here does not change the underlying OS thread names.
415-
// Instead, this is just additional metadata for the Dart VM Service to show the
415+
// Instead, this is just additional metadata for the Observatory to show the
416416
// thread name of the isolate.
417417
bool DartIsolate::UpdateThreadPoolNames() const {
418418
// TODO(chinmaygarde): This implementation does not account for multiple
@@ -766,7 +766,7 @@ Dart_Isolate DartIsolate::DartCreateAndStartServiceIsolate(
766766

767767
const auto& settings = vm_data->GetSettings();
768768

769-
if (!settings.enable_vm_service) {
769+
if (!settings.enable_observatory) {
770770
return nullptr;
771771
}
772772

@@ -802,8 +802,8 @@ Dart_Isolate DartIsolate::DartCreateAndStartServiceIsolate(
802802

803803
tonic::DartState::Scope scope(service_isolate);
804804
if (!DartServiceIsolate::Startup(
805-
settings.vm_service_host, // server IP address
806-
settings.vm_service_port, // server VM service port
805+
settings.observatory_host, // server IP address
806+
settings.observatory_port, // server observatory port
807807
tonic::DartState::HandleLibraryTag, // embedder library tag handler
808808
false, // disable websocket origin check
809809
settings.disable_service_auth_codes, // disable VM service auth codes

runtime/dart_isolate_unittests.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -404,9 +404,9 @@ TEST_F(DartIsolateTest, CanCreateServiceIsolate) {
404404
ASSERT_FALSE(DartVMRef::IsInstanceRunning());
405405
fml::AutoResetWaitableEvent service_isolate_latch;
406406
auto settings = CreateSettingsForFixture();
407-
settings.enable_vm_service = true;
408-
settings.vm_service_port = 0;
409-
settings.vm_service_host = "127.0.0.1";
407+
settings.enable_observatory = true;
408+
settings.observatory_port = 0;
409+
settings.observatory_host = "127.0.0.1";
410410
settings.enable_service_port_fallback = true;
411411
settings.service_isolate_create_callback = [&service_isolate_latch]() {
412412
service_isolate_latch.Signal();

runtime/dart_lifecycle_unittests.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ using DartLifecycleTest = FixtureTest;
1919
TEST_F(DartLifecycleTest, CanStartAndShutdownVM) {
2020
auto settings = CreateSettingsForFixture();
2121
settings.leak_vm = false;
22-
settings.enable_vm_service = false;
22+
settings.enable_observatory = false;
2323
ASSERT_FALSE(DartVMRef::IsInstanceRunning());
2424
{
2525
auto vm_ref = DartVMRef::Create(settings);
@@ -31,7 +31,7 @@ TEST_F(DartLifecycleTest, CanStartAndShutdownVM) {
3131
TEST_F(DartLifecycleTest, CanStartAndShutdownVMOverAndOver) {
3232
auto settings = CreateSettingsForFixture();
3333
settings.leak_vm = false;
34-
settings.enable_vm_service = false;
34+
settings.enable_observatory = false;
3535
ASSERT_FALSE(DartVMRef::IsInstanceRunning());
3636
auto count = DartVM::GetVMLaunchCount();
3737
for (size_t i = 0; i < 10; i++) {
@@ -89,7 +89,7 @@ TEST_F(DartLifecycleTest, DISABLED_ShuttingDownTheVMShutsDownAllIsolates) {
8989
auto settings = CreateSettingsForFixture();
9090
settings.leak_vm = false;
9191
// Make sure the service protocol launches
92-
settings.enable_vm_service = true;
92+
settings.enable_observatory = true;
9393

9494
auto thread_task_runner = CreateNewThread();
9595

runtime/dart_service_isolate.cc

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ namespace {
3333

3434
static Dart_LibraryTagHandler g_embedder_tag_handler;
3535
static tonic::DartLibraryNatives* g_natives;
36-
static std::string g_vm_service_uri;
36+
static std::string g_observatory_uri;
3737

3838
Dart_NativeFunction GetNativeFunction(Dart_Handle name,
3939
int argument_count,
@@ -51,7 +51,7 @@ const uint8_t* GetSymbol(Dart_NativeFunction native_function) {
5151

5252
std::mutex DartServiceIsolate::callbacks_mutex_;
5353

54-
std::set<std::unique_ptr<DartServiceIsolate::DartVMServiceServerStateCallback>>
54+
std::set<std::unique_ptr<DartServiceIsolate::ObservatoryServerStateCallback>>
5555
DartServiceIsolate::callbacks_;
5656

5757
void DartServiceIsolate::NotifyServerState(Dart_NativeArguments args) {
@@ -63,11 +63,11 @@ void DartServiceIsolate::NotifyServerState(Dart_NativeArguments args) {
6363
return;
6464
}
6565

66-
g_vm_service_uri = uri;
66+
g_observatory_uri = uri;
6767

6868
// Collect callbacks to fire in a separate collection and invoke them outside
6969
// the lock.
70-
std::vector<DartServiceIsolate::DartVMServiceServerStateCallback>
70+
std::vector<DartServiceIsolate::ObservatoryServerStateCallback>
7171
callbacks_to_fire;
7272
{
7373
std::scoped_lock lock(callbacks_mutex_);
@@ -82,13 +82,13 @@ void DartServiceIsolate::NotifyServerState(Dart_NativeArguments args) {
8282
}
8383

8484
DartServiceIsolate::CallbackHandle DartServiceIsolate::AddServerStatusCallback(
85-
const DartServiceIsolate::DartVMServiceServerStateCallback& callback) {
85+
const DartServiceIsolate::ObservatoryServerStateCallback& callback) {
8686
if (!callback) {
8787
return 0;
8888
}
8989

9090
auto callback_pointer =
91-
std::make_unique<DartServiceIsolate::DartVMServiceServerStateCallback>(
91+
std::make_unique<DartServiceIsolate::ObservatoryServerStateCallback>(
9292
callback);
9393

9494
auto handle = reinterpret_cast<CallbackHandle>(callback_pointer.get());
@@ -98,8 +98,8 @@ DartServiceIsolate::CallbackHandle DartServiceIsolate::AddServerStatusCallback(
9898
callbacks_.insert(std::move(callback_pointer));
9999
}
100100

101-
if (!g_vm_service_uri.empty()) {
102-
callback(g_vm_service_uri);
101+
if (!g_observatory_uri.empty()) {
102+
callback(g_observatory_uri);
103103
}
104104

105105
return handle;

runtime/dart_service_isolate.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ class DartServiceIsolate {
2727
using CallbackHandle = ptrdiff_t;
2828

2929
//----------------------------------------------------------------------------
30-
/// A callback made by the Dart VM when the VM Service is ready. The argument
31-
/// indicates the VM Service URI.
30+
/// A callback made by the Dart VM when the observatory is ready. The argument
31+
/// indicates the observatory URI.
3232
///
33-
using DartVMServiceServerStateCallback =
34-
std::function<void(const std::string& vm_service_uri)>;
33+
using ObservatoryServerStateCallback =
34+
std::function<void(const std::string& observatory_uri)>;
3535

3636
//----------------------------------------------------------------------------
3737
/// @brief Start the service isolate. This call may only be made in the
@@ -68,19 +68,19 @@ class DartServiceIsolate {
6868
char** error);
6969

7070
//----------------------------------------------------------------------------
71-
/// @brief Add a callback that will get invoked when the VM Service
72-
/// starts up. If the VM Service has already started before this
71+
/// @brief Add a callback that will get invoked when the observatory
72+
/// starts up. If the observatory has already started before this
7373
/// call is made, the callback is invoked immediately.
7474
///
7575
/// This method is thread safe.
7676
///
77-
/// @param[in] callback The callback with information about the VM Service.
77+
/// @param[in] callback The callback with information about the observatory.
7878
///
7979
/// @return A handle for the callback that can be used later in
8080
/// `RemoveServerStatusCallback`.
8181
///
8282
[[nodiscard]] static CallbackHandle AddServerStatusCallback(
83-
const DartVMServiceServerStateCallback& callback);
83+
const ObservatoryServerStateCallback& callback);
8484

8585
//----------------------------------------------------------------------------
8686
/// @brief Removed a callback previously registered via
@@ -101,7 +101,7 @@ class DartServiceIsolate {
101101
static void Shutdown(Dart_NativeArguments args);
102102

103103
static std::mutex callbacks_mutex_;
104-
static std::set<std::unique_ptr<DartVMServiceServerStateCallback>> callbacks_;
104+
static std::set<std::unique_ptr<ObservatoryServerStateCallback>> callbacks_;
105105
};
106106

107107
} // namespace flutter

shell/common/switches.cc

Lines changed: 17 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -235,55 +235,33 @@ Settings SettingsFromCommandLine(const fml::CommandLine& command_line) {
235235
settings.executable_name = command_line.argv0();
236236
}
237237

238-
// Enable the VM Service
239-
settings.enable_vm_service =
240-
!command_line.HasOption(FlagForSwitch(Switch::DisableVMService)) &&
241-
// TODO(bkonyi): remove once flutter_tools no longer uses this option.
242-
// See https://github.com/dart-lang/sdk/issues/50233
238+
// Enable Observatory
239+
settings.enable_observatory =
243240
!command_line.HasOption(FlagForSwitch(Switch::DisableObservatory));
244241

245-
// Enable mDNS VM Service Publication
246-
settings.enable_vm_service_publication =
247-
!command_line.HasOption(
248-
FlagForSwitch(Switch::DisableVMServicePublication)) &&
249-
!command_line.HasOption(
250-
FlagForSwitch(Switch::DisableObservatoryPublication));
251-
252-
// Set VM Service Host
253-
if (command_line.HasOption(FlagForSwitch(Switch::DeviceVMServiceHost))) {
254-
command_line.GetOptionValue(FlagForSwitch(Switch::DeviceVMServiceHost),
255-
&settings.vm_service_host);
256-
} else if (command_line.HasOption(
257-
FlagForSwitch(Switch::DeviceObservatoryHost))) {
258-
// TODO(bkonyi): remove once flutter_tools no longer uses this option.
259-
// See https://github.com/dart-lang/sdk/issues/50233
242+
// Enable mDNS Observatory Publication
243+
settings.enable_observatory_publication = !command_line.HasOption(
244+
FlagForSwitch(Switch::DisableObservatoryPublication));
245+
246+
// Set Observatory Host
247+
if (command_line.HasOption(FlagForSwitch(Switch::DeviceObservatoryHost))) {
260248
command_line.GetOptionValue(FlagForSwitch(Switch::DeviceObservatoryHost),
261-
&settings.vm_service_host);
249+
&settings.observatory_host);
262250
}
263-
// Default the VM Service port based on --ipv6 if not set.
264-
if (settings.vm_service_host.empty()) {
265-
settings.vm_service_host =
251+
// Default the observatory port based on --ipv6 if not set.
252+
if (settings.observatory_host.empty()) {
253+
settings.observatory_host =
266254
command_line.HasOption(FlagForSwitch(Switch::IPv6)) ? "::1"
267255
: "127.0.0.1";
268256
}
269257

270-
// Set VM Service Port
271-
if (command_line.HasOption(FlagForSwitch(Switch::DeviceVMServicePort))) {
272-
if (!GetSwitchValue(command_line, Switch::DeviceVMServicePort,
273-
&settings.vm_service_port)) {
274-
FML_LOG(INFO)
275-
<< "VM Service port specified was malformed. Will default to "
276-
<< settings.vm_service_port;
277-
}
278-
} else if (command_line.HasOption(
279-
FlagForSwitch(Switch::DeviceObservatoryPort))) {
280-
// TODO(bkonyi): remove once flutter_tools no longer uses this option.
281-
// See https://github.com/dart-lang/sdk/issues/50233
258+
// Set Observatory Port
259+
if (command_line.HasOption(FlagForSwitch(Switch::DeviceObservatoryPort))) {
282260
if (!GetSwitchValue(command_line, Switch::DeviceObservatoryPort,
283-
&settings.vm_service_port)) {
261+
&settings.observatory_port)) {
284262
FML_LOG(INFO)
285-
<< "VM Service port specified was malformed. Will default to "
286-
<< settings.vm_service_port;
263+
<< "Observatory port specified was malformed. Will default to "
264+
<< settings.observatory_port;
287265
}
288266
}
289267

0 commit comments

Comments
 (0)