From cab7c8d7b3b5d31d9128f8c28d3289f38a9d9c4e Mon Sep 17 00:00:00 2001 From: John McCutchan Date: Thu, 11 Aug 2016 13:14:13 -0700 Subject: [PATCH] Rename Observatory to VMService (#5349) --- .../flutter_tools/lib/src/android/android_device.dart | 4 ++-- packages/flutter_tools/lib/src/commands/run.dart | 4 ++-- packages/flutter_tools/lib/src/commands/trace.dart | 8 ++++---- packages/flutter_tools/lib/src/devfs.dart | 8 ++++---- packages/flutter_tools/lib/src/device.dart | 4 ++-- packages/flutter_tools/lib/src/hot.dart | 4 ++-- packages/flutter_tools/lib/src/ios/devices.dart | 4 ++-- packages/flutter_tools/lib/src/resident_runner.dart | 6 +++--- packages/flutter_tools/lib/src/run.dart | 2 +- packages/flutter_tools/lib/src/view.dart | 4 ++-- .../lib/src/{observatory.dart => vmservice.dart} | 8 ++++---- 11 files changed, 28 insertions(+), 28 deletions(-) rename packages/flutter_tools/lib/src/{observatory.dart => vmservice.dart} (98%) diff --git a/packages/flutter_tools/lib/src/android/android_device.dart b/packages/flutter_tools/lib/src/android/android_device.dart index 0b717559ab..c2d8738278 100644 --- a/packages/flutter_tools/lib/src/android/android_device.dart +++ b/packages/flutter_tools/lib/src/android/android_device.dart @@ -16,7 +16,7 @@ import '../build_info.dart'; import '../device.dart'; import '../flx.dart' as flx; import '../globals.dart'; -import '../observatory.dart'; +import '../vmservice.dart'; import '../protocol_discovery.dart'; import 'adb.dart'; import 'android.dart'; @@ -421,7 +421,7 @@ class AndroidDevice extends Device { ApplicationPackage package, LaunchResult result, { String mainPath, - Observatory observatory + VMService observatory }) async { Directory tempDir = await Directory.systemTemp.createTemp('flutter_tools'); diff --git a/packages/flutter_tools/lib/src/commands/run.dart b/packages/flutter_tools/lib/src/commands/run.dart index 944b10cc64..876e144746 100644 --- a/packages/flutter_tools/lib/src/commands/run.dart +++ b/packages/flutter_tools/lib/src/commands/run.dart @@ -13,7 +13,7 @@ import '../cache.dart'; import '../device.dart'; import '../globals.dart'; import '../hot.dart'; -import '../observatory.dart'; +import '../vmservice.dart'; import '../resident_runner.dart'; import '../run.dart'; import '../runner/flutter_command.dart'; @@ -275,7 +275,7 @@ Future startApp( printError('Error running application on ${device.name}.'); } else if (traceStartup) { try { - Observatory observatory = await Observatory.connect(result.observatoryPort); + VMService observatory = await VMService.connect(result.observatoryPort); await downloadStartupTrace(observatory); } catch (error) { printError('Error downloading trace from observatory: $error'); diff --git a/packages/flutter_tools/lib/src/commands/trace.dart b/packages/flutter_tools/lib/src/commands/trace.dart index da920b61c0..2632c7f360 100644 --- a/packages/flutter_tools/lib/src/commands/trace.dart +++ b/packages/flutter_tools/lib/src/commands/trace.dart @@ -10,7 +10,7 @@ import '../base/common.dart'; import '../base/utils.dart'; import '../cache.dart'; import '../globals.dart'; -import '../observatory.dart'; +import '../vmservice.dart'; import '../runner/flutter_command.dart'; // Names of some of the Timeline events we care about. @@ -98,10 +98,10 @@ class Tracing { Tracing(this.observatory); static Future connect(int port) { - return Observatory.connect(port).then((Observatory observatory) => new Tracing(observatory)); + return VMService.connect(port).then((VMService observatory) => new Tracing(observatory)); } - final Observatory observatory; + final VMService observatory; Future startTracing() async { await observatory.setVMTimelineFlags(['Compiler', 'Dart', 'Embedder', 'GC']); @@ -153,7 +153,7 @@ class Tracing { /// Download the startup trace information from the given observatory client and /// store it to build/start_up_info.json. -Future downloadStartupTrace(Observatory observatory) async { +Future downloadStartupTrace(VMService observatory) async { File traceInfoFile = new File('build/start_up_info.json'); if (await traceInfoFile.exists()) diff --git a/packages/flutter_tools/lib/src/devfs.dart b/packages/flutter_tools/lib/src/devfs.dart index 36b374a939..b6addc5100 100644 --- a/packages/flutter_tools/lib/src/devfs.dart +++ b/packages/flutter_tools/lib/src/devfs.dart @@ -12,7 +12,7 @@ import 'base/logger.dart'; import 'dart/package_map.dart'; import 'asset.dart'; import 'globals.dart'; -import 'observatory.dart'; +import 'vmservice.dart'; typedef void DevFSProgressReporter(int progress, int max); @@ -108,7 +108,7 @@ abstract class DevFSOperations { /// An implementation of [DevFSOperations] that speaks to the /// service protocol. class ServiceProtocolDevFSOperations implements DevFSOperations { - final Observatory serviceProtocol; + final VMService serviceProtocol; ServiceProtocolDevFSOperations(this.serviceProtocol); @@ -165,7 +165,7 @@ class ServiceProtocolDevFSOperations implements DevFSOperations { } class _DevFSHttpWriter { - _DevFSHttpWriter(this.fsName, Observatory serviceProtocol) + _DevFSHttpWriter(this.fsName, VMService serviceProtocol) : httpAddress = serviceProtocol.httpAddress; final String fsName; @@ -230,7 +230,7 @@ class _DevFSHttpWriter { class DevFS { /// Create a [DevFS] named [fsName] for the local files in [directory]. - DevFS(Observatory serviceProtocol, + DevFS(VMService serviceProtocol, String fsName, this.rootDirectory) : _operations = new ServiceProtocolDevFSOperations(serviceProtocol), diff --git a/packages/flutter_tools/lib/src/device.dart b/packages/flutter_tools/lib/src/device.dart index ed53c6ef79..62a6ba5533 100644 --- a/packages/flutter_tools/lib/src/device.dart +++ b/packages/flutter_tools/lib/src/device.dart @@ -13,7 +13,7 @@ import 'base/os.dart'; import 'base/utils.dart'; import 'build_info.dart'; import 'globals.dart'; -import 'observatory.dart'; +import 'vmservice.dart'; import 'ios/devices.dart'; import 'ios/simulators.dart'; @@ -209,7 +209,7 @@ abstract class Device { ApplicationPackage package, LaunchResult result, { String mainPath, - Observatory observatory + VMService observatory }) async { throw 'unsupported'; } diff --git a/packages/flutter_tools/lib/src/hot.dart b/packages/flutter_tools/lib/src/hot.dart index 0fb35c23ed..cb318c5c3a 100644 --- a/packages/flutter_tools/lib/src/hot.dart +++ b/packages/flutter_tools/lib/src/hot.dart @@ -20,7 +20,7 @@ import 'dart/package_map.dart'; import 'device.dart'; import 'globals.dart'; import 'devfs.dart'; -import 'observatory.dart'; +import 'vmservice.dart'; import 'resident_runner.dart'; import 'toolchain.dart'; import 'view.dart'; @@ -108,7 +108,7 @@ class FirstFrameTimer { return stopwatch.elapsed; } - final Observatory serviceProtocol; + final VMService serviceProtocol; final Stopwatch stopwatch = new Stopwatch(); final Completer _completer = new Completer(); StreamSubscription _subscription; diff --git a/packages/flutter_tools/lib/src/ios/devices.dart b/packages/flutter_tools/lib/src/ios/devices.dart index 64730d5991..bf96b72dc1 100644 --- a/packages/flutter_tools/lib/src/ios/devices.dart +++ b/packages/flutter_tools/lib/src/ios/devices.dart @@ -12,7 +12,7 @@ import '../base/process.dart'; import '../build_info.dart'; import '../device.dart'; import '../globals.dart'; -import '../observatory.dart'; +import '../vmservice.dart'; import '../protocol_discovery.dart'; import 'mac.dart'; @@ -328,7 +328,7 @@ class IOSDevice extends Device { ApplicationPackage package, LaunchResult result, { String mainPath, - Observatory observatory + VMService observatory }) async { throw 'unsupported'; } diff --git a/packages/flutter_tools/lib/src/resident_runner.dart b/packages/flutter_tools/lib/src/resident_runner.dart index 0aea86faea..a6c1be28d0 100644 --- a/packages/flutter_tools/lib/src/resident_runner.dart +++ b/packages/flutter_tools/lib/src/resident_runner.dart @@ -11,7 +11,7 @@ import 'base/logger.dart'; import 'build_info.dart'; import 'device.dart'; import 'globals.dart'; -import 'observatory.dart'; +import 'vmservice.dart'; import 'view.dart'; // Shared code between different resident application runners. @@ -28,7 +28,7 @@ abstract class ResidentRunner { final bool usesTerminalUI; final Completer _finished = new Completer(); - Observatory serviceProtocol; + VMService serviceProtocol; ViewManager viewManager; StreamSubscription _loggingSubscription; @@ -89,7 +89,7 @@ abstract class ResidentRunner { if (!debuggingOptions.debuggingEnabled) { return new Future.error('Error the service protocol is not enabled.'); } - serviceProtocol = await Observatory.connect(port); + serviceProtocol = await VMService.connect(port); printTrace('Connected to service protocol on port $port'); serviceProtocol.populateIsolateInfo(); serviceProtocol.onExtensionEvent.listen((Event event) { diff --git a/packages/flutter_tools/lib/src/run.dart b/packages/flutter_tools/lib/src/run.dart index 4764905cd5..7145338533 100644 --- a/packages/flutter_tools/lib/src/run.dart +++ b/packages/flutter_tools/lib/src/run.dart @@ -13,7 +13,7 @@ import 'commands/install.dart'; import 'commands/trace.dart'; import 'device.dart'; import 'globals.dart'; -import 'observatory.dart'; +import 'vmservice.dart'; import 'resident_runner.dart'; class RunAndStayResident extends ResidentRunner { diff --git a/packages/flutter_tools/lib/src/view.dart b/packages/flutter_tools/lib/src/view.dart index fb4085c76a..f425fb8252 100644 --- a/packages/flutter_tools/lib/src/view.dart +++ b/packages/flutter_tools/lib/src/view.dart @@ -5,7 +5,7 @@ import 'dart:async'; import 'globals.dart'; -import 'observatory.dart'; +import 'vmservice.dart'; /// Peered to a Android/iOS FlutterView widget on a device. class FlutterView { @@ -41,7 +41,7 @@ class FlutterView { class ViewManager { ViewManager(this.serviceProtocol); - final Observatory serviceProtocol; + final VMService serviceProtocol; Future refresh() async { List> viewList = await serviceProtocol.getViewList(); diff --git a/packages/flutter_tools/lib/src/observatory.dart b/packages/flutter_tools/lib/src/vmservice.dart similarity index 98% rename from packages/flutter_tools/lib/src/observatory.dart rename to packages/flutter_tools/lib/src/vmservice.dart index 0381ef1800..569a35effd 100644 --- a/packages/flutter_tools/lib/src/observatory.dart +++ b/packages/flutter_tools/lib/src/vmservice.dart @@ -12,8 +12,8 @@ import 'package:web_socket_channel/io.dart'; import 'globals.dart'; // TODO(johnmccutchan): Rename this class to ServiceProtocol or VmService. -class Observatory { - Observatory._(this.peer, this.port, this.httpAddress) { +class VMService { + VMService._(this.peer, this.port, this.httpAddress) { peer.registerMethod('streamNotify', (rpc.Parameters event) { _handleStreamNotify(event.asMap); }); @@ -28,13 +28,13 @@ class Observatory { }); } - static Future connect(int port) async { + static Future connect(int port) async { Uri uri = new Uri(scheme: 'ws', host: '127.0.0.1', port: port, path: 'ws'); WebSocket ws = await WebSocket.connect(uri.toString()); rpc.Peer peer = new rpc.Peer(new IOWebSocketChannel(ws)); peer.listen(); Uri httpAddress = new Uri(scheme: 'http', host: '127.0.0.1', port: port); - return new Observatory._(peer, port, httpAddress); + return new VMService._(peer, port, httpAddress); } final Uri httpAddress; final rpc.Peer peer;