Rename Observatory to VMService (#5349)

diff --git a/packages/flutter_tools/lib/src/android/android_device.dart b/packages/flutter_tools/lib/src/android/android_device.dart
index 0b71755..c2d8738 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 '../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 @@
     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 944b10c..876e144 100644
--- a/packages/flutter_tools/lib/src/commands/run.dart
+++ b/packages/flutter_tools/lib/src/commands/run.dart
@@ -13,7 +13,7 @@
 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 @@
     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 da920b6..2632c7f 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/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 @@
   Tracing(this.observatory);
 
   static Future<Tracing> 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<Null> startTracing() async {
     await observatory.setVMTimelineFlags(<String>['Compiler', 'Dart', 'Embedder', 'GC']);
@@ -153,7 +153,7 @@
 
 /// Download the startup trace information from the given observatory client and
 /// store it to build/start_up_info.json.
-Future<Null> downloadStartupTrace(Observatory observatory) async {
+Future<Null> 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 36b374a..b6addc5 100644
--- a/packages/flutter_tools/lib/src/devfs.dart
+++ b/packages/flutter_tools/lib/src/devfs.dart
@@ -12,7 +12,7 @@
 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 @@
 /// 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 _DevFSHttpWriter {
-  _DevFSHttpWriter(this.fsName, Observatory serviceProtocol)
+  _DevFSHttpWriter(this.fsName, VMService serviceProtocol)
       : httpAddress = serviceProtocol.httpAddress;
 
   final String fsName;
@@ -230,7 +230,7 @@
 
 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 ed53c6e..62a6ba5 100644
--- a/packages/flutter_tools/lib/src/device.dart
+++ b/packages/flutter_tools/lib/src/device.dart
@@ -13,7 +13,7 @@
 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 @@
     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 0fb35c2..cb318c5 100644
--- a/packages/flutter_tools/lib/src/hot.dart
+++ b/packages/flutter_tools/lib/src/hot.dart
@@ -20,7 +20,7 @@
 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 @@
     return stopwatch.elapsed;
   }
 
-  final Observatory serviceProtocol;
+  final VMService serviceProtocol;
   final Stopwatch stopwatch = new Stopwatch();
   final Completer<Null> _completer = new Completer<Null>();
   StreamSubscription<Event> _subscription;
diff --git a/packages/flutter_tools/lib/src/ios/devices.dart b/packages/flutter_tools/lib/src/ios/devices.dart
index 64730d5..bf96b72 100644
--- a/packages/flutter_tools/lib/src/ios/devices.dart
+++ b/packages/flutter_tools/lib/src/ios/devices.dart
@@ -12,7 +12,7 @@
 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 @@
     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 0aea86f..a6c1be2 100644
--- a/packages/flutter_tools/lib/src/resident_runner.dart
+++ b/packages/flutter_tools/lib/src/resident_runner.dart
@@ -11,7 +11,7 @@
 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 @@
   final bool usesTerminalUI;
   final Completer<int> _finished = new Completer<int>();
 
-  Observatory serviceProtocol;
+  VMService serviceProtocol;
   ViewManager viewManager;
   StreamSubscription<String> _loggingSubscription;
 
@@ -89,7 +89,7 @@
     if (!debuggingOptions.debuggingEnabled) {
       return new Future<Null>.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 4764905..7145338 100644
--- a/packages/flutter_tools/lib/src/run.dart
+++ b/packages/flutter_tools/lib/src/run.dart
@@ -13,7 +13,7 @@
 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 fb4085c..f425fb8 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 ViewManager {
   ViewManager(this.serviceProtocol);
 
-  final Observatory serviceProtocol;
+  final VMService serviceProtocol;
 
   Future<Null> refresh() async {
     List<Map<String, String>> viewList = await serviceProtocol.getViewList();
diff --git a/packages/flutter_tools/lib/src/observatory.dart b/packages/flutter_tools/lib/src/vmservice.dart
similarity index 97%
rename from packages/flutter_tools/lib/src/observatory.dart
rename to packages/flutter_tools/lib/src/vmservice.dart
index 0381ef1..569a35e 100644
--- a/packages/flutter_tools/lib/src/observatory.dart
+++ b/packages/flutter_tools/lib/src/vmservice.dart
@@ -12,8 +12,8 @@
 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 @@
     });
   }
 
-  static Future<Observatory> connect(int port) async {
+  static Future<VMService> 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;