[go: nahoru, domu]

Skip to content

Commit

Permalink
Revert "Remove references to Observatory (#118577)" (#120929)
Browse files Browse the repository at this point in the history
This reverts commit 2df140f.
  • Loading branch information
Casey Hillers committed Feb 17, 2023
1 parent 78d058f commit 298d8c7
Show file tree
Hide file tree
Showing 90 changed files with 492 additions and 495 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/5_performance_speed.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ assignees: ''
can have an intuitive understanding of what happened. Don’t use
"adb screenrecord", as that affects the performance of the profile run.
5. Open Flutter DevTools and save a timeline trace of the performance issue
5. Open Observatory and save a timeline trace of the performance issue
so we know which functions might be causing it. See "How to Collect
and Read Timeline Traces" on this blog post:
https://medium.com/flutter/profiling-flutter-applications-using-the-timeline-a1a434964af3#a499
Expand Down
2 changes: 1 addition & 1 deletion dev/devicelab/lib/framework/runner.dart
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ Future<TaskResult> runTask(
.transform<String>(const LineSplitter())
.listen((String line) {
if (!uri.isCompleted) {
final Uri? serviceUri = parseServiceUri(line, prefix: RegExp('The Dart VM service is listening on '));
final Uri? serviceUri = parseServiceUri(line, prefix: RegExp('(Observatory|The Dart VM service is) listening on '));
if (serviceUri != null) {
uri.complete(serviceUri);
}
Expand Down
6 changes: 3 additions & 3 deletions dev/devicelab/lib/framework/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -664,14 +664,14 @@ Future<void> runAndCaptureAsyncStacks(Future<void> Function() callback) {
bool canRun(String path) => _processManager.canRun(path);

final RegExp _obsRegExp =
RegExp('A Dart VM Service .* is available at: ');
RegExp('An Observatory debugger .* is available at: ');
final RegExp _obsPortRegExp = RegExp(r'(\S+:(\d+)/\S*)$');
final RegExp _obsUriRegExp = RegExp(r'((http|//)[a-zA-Z0-9:/=_\-\.\[\]]+)');

/// Tries to extract a port from the string.
///
/// The `prefix`, if specified, is a regular expression pattern and must not contain groups.
/// `prefix` defaults to the RegExp: `A Dart VM Service .* is available at: `.
/// `prefix` defaults to the RegExp: `An Observatory debugger .* is available at: `.
int? parseServicePort(String line, {
Pattern? prefix,
}) {
Expand All @@ -689,7 +689,7 @@ int? parseServicePort(String line, {
/// Tries to extract a URL from the string.
///
/// The `prefix`, if specified, is a regular expression pattern and must not contain groups.
/// `prefix` defaults to the RegExp: `A Dart VM Service .* is available at: `.
/// `prefix` defaults to the RegExp: `An Observatory debugger .* is available at: `.
Uri? parseServiceUri(String line, {
Pattern? prefix,
}) {
Expand Down
8 changes: 4 additions & 4 deletions dev/devicelab/lib/tasks/perf_tests.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1184,11 +1184,11 @@ class PerfTestWithSkSL extends PerfTest {
await _generateSkSL();

// Build the app with SkSL artifacts and run that app
final String vmServiceUri = await _runApp(skslPath: _skslJsonFileName);
final String observatoryUri = await _runApp(skslPath: _skslJsonFileName);

// Attach to the running app and run the final driver test to get metrics.
final TaskResult result = await internalRun(
existingApp: vmServiceUri,
existingApp: observatoryUri,
);

_runProcess.kill();
Expand All @@ -1207,8 +1207,8 @@ class PerfTestWithSkSL extends PerfTest {
// `--write-sksl-on-exit` option doesn't seem to be compatible with
// `flutter drive --existing-app` as it will complain web socket connection
// issues.
final String vmServiceUri = await _runApp(cacheSkSL: true);
await super.internalRun(cacheSkSL: true, existingApp: vmServiceUri);
final String observatoryUri = await _runApp(cacheSkSL: true);
await super.internalRun(cacheSkSL: true, existingApp: observatoryUri);
_runProcess.kill();
await _runProcess.exitCode;

Expand Down
2 changes: 1 addition & 1 deletion dev/devicelab/test/utils_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ void main() {

group('parse service', () {
const String badOutput = 'No uri here';
const String sampleOutput = 'A Dart VM Service on '
const String sampleOutput = 'An Observatory debugger and profiler on '
'Pixel 3 XL is available at: http://127.0.0.1:9090/LpjUpsdEjqI=/';

test('uri', () {
Expand Down
2 changes: 1 addition & 1 deletion packages/flutter/lib/src/foundation/binding.dart
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ abstract class BindingBase {
/// First calls [initInstances] to have bindings initialize their
/// instance pointers and other state, then calls
/// [initServiceExtensions] to have bindings initialize their
/// VM service extensions, if any.
/// observatory service extensions, if any.
BindingBase() {
developer.Timeline.startSync('Framework initialization');
assert(() {
Expand Down
4 changes: 2 additions & 2 deletions packages/flutter/lib/src/painting/shader_warm_up.dart
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ abstract class ShaderWarmUp {
///
/// To decide which draw operations to be added to your custom warm up
/// process, consider capturing an skp using `flutter screenshot
/// --vm-service-uri=<uri> --type=skia` and analyzing it with
/// --observatory-uri=<uri> --type=skia` and analyzing it with
/// <https://debugger.skia.org/>. Alternatively, one may run the app with
/// `flutter run --trace-skia` and then examine the raster thread in the
/// Flutter DevTools timeline to see which Skia draw operations are commonly used,
/// observatory timeline to see which Skia draw operations are commonly used,
/// and which shader compilations are causing jank.
@protected
Future<void> warmUpOnCanvas(ui.Canvas canvas);
Expand Down
6 changes: 3 additions & 3 deletions packages/flutter/lib/src/widgets/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1174,7 +1174,7 @@ class WidgetsApp extends StatefulWidget {

/// If true, forces the performance overlay to be visible in all instances.
///
/// Used by the `showPerformanceOverlay` VM service extension.
/// Used by the `showPerformanceOverlay` observatory extension.
static bool showPerformanceOverlayOverride = false;

/// If true, forces the widget inspector to be visible.
Expand All @@ -1184,12 +1184,12 @@ class WidgetsApp extends StatefulWidget {
/// The inspector allows you to select a location on your device or emulator
/// and view what widgets and render objects associated with it. An outline of
/// the selected widget and some summary information is shown on device and
/// more detailed information is shown in the IDE or DevTools.
/// more detailed information is shown in the IDE or Observatory.
static bool debugShowWidgetInspectorOverride = false;

/// If false, prevents the debug banner from being visible.
///
/// Used by the `debugAllowBanner` VM service extension.
/// Used by the `debugAllowBanner` observatory extension.
///
/// This is how `flutter run` turns off the banner when you take a screen shot
/// with "s".
Expand Down
4 changes: 2 additions & 2 deletions packages/flutter/lib/src/widgets/debug.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ import 'table.dart';
/// Combined with [debugPrintScheduleBuildForStacks], this lets you watch a
/// widget's dirty/clean lifecycle.
///
/// To get similar information but showing it on the timeline available from
/// Flutter DevTools rather than getting it in the console (where it can be
/// To get similar information but showing it on the timeline available from the
/// Observatory rather than getting it in the console (where it can be
/// overwhelming), consider [debugProfileBuildsEnabled].
///
/// See also:
Expand Down
8 changes: 4 additions & 4 deletions packages/flutter/lib/src/widgets/widget_inspector.dart
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,7 @@ class _WidgetInspectorService = Object with WidgetInspectorService;
/// operation making it easier to avoid memory leaks.
///
/// All methods in this class are appropriate to invoke from debugging tools
/// using the VM service protocol to evaluate Dart expressions of the
/// using the Observatory service protocol to evaluate Dart expressions of the
/// form `WidgetInspectorService.instance.methodName(arg1, arg2, ...)`. If you
/// make changes to any instance method of this class you need to verify that
/// the [Flutter IntelliJ Plugin](https://github.com/flutter/flutter-intellij/blob/master/README.md)
Expand All @@ -712,7 +712,7 @@ class _WidgetInspectorService = Object with WidgetInspectorService;
/// All methods returning String values return JSON.
mixin WidgetInspectorService {
/// Ring of cached JSON values to prevent JSON from being garbage
/// collected before it can be requested over the VM service protocol.
/// collected before it can be requested over the Observatory protocol.
final List<String?> _serializeRing = List<String?>.filled(20, null);
int _serializeRingIndex = 0;

Expand All @@ -739,7 +739,7 @@ mixin WidgetInspectorService {
/// when the inspection target changes on device.
InspectorSelectionChangedCallback? selectionChangedCallback;

/// The VM service protocol does not keep alive object references so this
/// The Observatory protocol does not keep alive object references so this
/// class needs to manually manage groups of objects that should be kept
/// alive.
final Map<String, Set<_InspectorReferenceData>> _groups = <String, Set<_InspectorReferenceData>>{};
Expand Down Expand Up @@ -1690,7 +1690,7 @@ mixin WidgetInspectorService {

/// Wrapper around `json.encode` that uses a ring of cached values to prevent
/// the Dart garbage collector from collecting objects between when
/// the value is returned over the VM service protocol and when the
/// the value is returned over the Observatory protocol and when the
/// separate observatory protocol command has to be used to retrieve its full
/// contents.
//
Expand Down
2 changes: 1 addition & 1 deletion packages/flutter_tools/bin/fuchsia_tester.dart
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ Future<void> run(List<String> args) async {
),
),
watcher: collector,
enableVmService: collector != null,
enableObservatory: collector != null,
precompiledDillFiles: tests,
concurrency: math.max(1, globals.platform.numberOfProcessors - 2),
icudtlPath: globals.fs.path.absolute(argResults[_kOptionIcudtl] as String),
Expand Down
20 changes: 10 additions & 10 deletions packages/flutter_tools/bin/xcode_backend.dart
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ class Context {
// Thinning is handled during the bundle asset assemble build target, so just embed.
embedFlutterFrameworks();
break;
case 'test_vm_service_bonjour_service':
case 'test_observatory_bonjour_service':
// Exposed for integration testing only.
addVmServiceBonjourService();
addObservatoryBonjourService();
}
}

Expand Down Expand Up @@ -220,11 +220,11 @@ class Context {
],
);

addVmServiceBonjourService();
addObservatoryBonjourService();
}

// Add the vmService publisher Bonjour service to the produced app bundle Info.plist.
void addVmServiceBonjourService() {
// Add the observatory publisher Bonjour service to the produced app bundle Info.plist.
void addObservatoryBonjourService() {
final String buildMode = parseFlutterBuildMode();

// Debug and profile only.
Expand All @@ -239,13 +239,13 @@ class Context {
// The file will be present on re-run.
echo(
'${environment['INFOPLIST_PATH'] ?? ''} does not exist. Skipping '
'_dartVmService._tcp NSBonjourServices insertion. Try re-building to '
'_dartobservatory._tcp NSBonjourServices insertion. Try re-building to '
'enable "flutter attach".');
return;
}

// If there are already NSBonjourServices specified by the app (uncommon),
// insert the vmService service name to the existing list.
// insert the observatory service name to the existing list.
ProcessResult result = runSync(
'plutil',
<String>[
Expand All @@ -265,19 +265,19 @@ class Context {
'-insert',
'NSBonjourServices.0',
'-string',
'_dartVmService._tcp',
'_dartobservatory._tcp',
builtProductsPlist,
],
);
} else {
// Otherwise, add the NSBonjourServices key and vmService service name.
// Otherwise, add the NSBonjourServices key and observatory service name.
runSync(
'plutil',
<String>[
'-insert',
'NSBonjourServices',
'-json',
'["_dartVmService._tcp"]',
'["_dartobservatory._tcp"]',
builtProductsPlist,
],
);
Expand Down
2 changes: 1 addition & 1 deletion packages/flutter_tools/doc/attach.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ immediately discover the port
will search for an already running Flutter app or module if available.
Otherwise, the tool will wait for the next Flutter app or module to launch
before attaching.
1. If the app or module is already running and the specific VM Service port is
1. If the app or module is already running and the specific observatory port is
known, it can be explicitly provided to attach via the command-line, e.g.
`$ flutter attach --debug-port 12345`

Expand Down
2 changes: 1 addition & 1 deletion packages/flutter_tools/doc/daemon.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ This is sent when an app is starting. The `params` field will be a map with the

#### app.debugPort

This is sent when a VM service port is available for a started app. The `params` field will be a map with the fields `appId`, `port`, and `wsUri`. Clients should prefer using the `wsUri` field in preference to synthesizing a URI using the `port` field. An optional field, `baseUri`, is populated if a path prefix is required for setting breakpoints on the target device.
This is sent when an observatory port is available for a started app. The `params` field will be a map with the fields `appId`, `port`, and `wsUri`. Clients should prefer using the `wsUri` field in preference to synthesizing a URI using the `port` field. An optional field, `baseUri`, is populated if a path prefix is required for setting breakpoints on the target device.

#### app.started

Expand Down
20 changes: 10 additions & 10 deletions packages/flutter_tools/lib/src/android/android_device.dart
Original file line number Diff line number Diff line change
Expand Up @@ -599,12 +599,12 @@ class AndroidDevice extends Device {
}

final bool traceStartup = platformArgs['trace-startup'] as bool? ?? false;
ProtocolDiscovery? vmServiceDiscovery;
ProtocolDiscovery? observatoryDiscovery;

if (debuggingOptions.debuggingEnabled) {
vmServiceDiscovery = ProtocolDiscovery.vmService(
observatoryDiscovery = ProtocolDiscovery.observatory(
// Avoid using getLogReader, which returns a singleton instance, because the
// VM Service discovery will dipose at the end. creating a new logger here allows
// observatory discovery will dipose at the end. creating a new logger here allows
// logs to be surfaced normally during `flutter drive`.
await AdbLogReader.createLogReader(
this,
Expand Down Expand Up @@ -687,26 +687,26 @@ class AndroidDevice extends Device {
}

// Wait for the service protocol port here. This will complete once the
// device has printed "VM Service is listening on...".
_logger.printTrace('Waiting for VM Service port to be available...');
// device has printed "Observatory is listening on...".
_logger.printTrace('Waiting for observatory port to be available...');
try {
Uri? vmServiceUri;
Uri? observatoryUri;
if (debuggingOptions.buildInfo.isDebug || debuggingOptions.buildInfo.isProfile) {
vmServiceUri = await vmServiceDiscovery?.uri;
if (vmServiceUri == null) {
observatoryUri = await observatoryDiscovery?.uri;
if (observatoryUri == null) {
_logger.printError(
'Error waiting for a debug connection: '
'The log reader stopped unexpectedly',
);
return LaunchResult.failed();
}
}
return LaunchResult.succeeded(vmServiceUri: vmServiceUri);
return LaunchResult.succeeded(observatoryUri: observatoryUri);
} on Exception catch (error) {
_logger.printError('Error waiting for a debug connection: $error');
return LaunchResult.failed();
} finally {
await vmServiceDiscovery?.cancel();
await observatoryDiscovery?.cancel();
}
}

Expand Down
6 changes: 3 additions & 3 deletions packages/flutter_tools/lib/src/base/dds.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class DartDevelopmentService {
final Completer<void> _completer = Completer<void>();

Future<void> startDartDevelopmentService(
Uri vmServiceUri, {
Uri observatoryUri, {
required Logger logger,
int? hostPort,
bool? ipv6,
Expand All @@ -49,11 +49,11 @@ class DartDevelopmentService {
);
logger.printTrace(
'Launching a Dart Developer Service (DDS) instance at $ddsUri, '
'connecting to VM service at $vmServiceUri.',
'connecting to VM service at $observatoryUri.',
);
try {
_ddsInstance = await ddsLauncherCallback(
vmServiceUri,
observatoryUri,
serviceUri: ddsUri,
enableAuthCodes: disableServiceAuthCodes != true,
ipv6: ipv6 ?? false,
Expand Down
8 changes: 4 additions & 4 deletions packages/flutter_tools/lib/src/build_info.dart
Original file line number Diff line number Diff line change
Expand Up @@ -394,16 +394,16 @@ class BuildMode {
throw ArgumentError('$value is not a supported build mode');
}

/// Built in JIT mode with no optimizations, enabled asserts, and a VM service.
/// Built in JIT mode with no optimizations, enabled asserts, and an observatory.
static const BuildMode debug = BuildMode._('debug');

/// Built in AOT mode with some optimizations and a VM service.
/// Built in AOT mode with some optimizations and an observatory.
static const BuildMode profile = BuildMode._('profile');

/// Built in AOT mode with all optimizations and no VM service.
/// Built in AOT mode with all optimizations and no observatory.
static const BuildMode release = BuildMode._('release');

/// Built in JIT mode with all optimizations and no VM service.
/// Built in JIT mode with all optimizations and no observatory.
static const BuildMode jitRelease = BuildMode._('jit_release');

static const List<BuildMode> values = <BuildMode>[
Expand Down
Loading

0 comments on commit 298d8c7

Please sign in to comment.