Commit cab7c8d7 authored by John McCutchan's avatar John McCutchan Committed by GitHub

Rename Observatory to VMService (#5349)

parent 728e2a56
...@@ -16,7 +16,7 @@ import '../build_info.dart'; ...@@ -16,7 +16,7 @@ import '../build_info.dart';
import '../device.dart'; import '../device.dart';
import '../flx.dart' as flx; import '../flx.dart' as flx;
import '../globals.dart'; import '../globals.dart';
import '../observatory.dart'; import '../vmservice.dart';
import '../protocol_discovery.dart'; import '../protocol_discovery.dart';
import 'adb.dart'; import 'adb.dart';
import 'android.dart'; import 'android.dart';
...@@ -421,7 +421,7 @@ class AndroidDevice extends Device { ...@@ -421,7 +421,7 @@ class AndroidDevice extends Device {
ApplicationPackage package, ApplicationPackage package,
LaunchResult result, { LaunchResult result, {
String mainPath, String mainPath,
Observatory observatory VMService observatory
}) async { }) async {
Directory tempDir = await Directory.systemTemp.createTemp('flutter_tools'); Directory tempDir = await Directory.systemTemp.createTemp('flutter_tools');
......
...@@ -13,7 +13,7 @@ import '../cache.dart'; ...@@ -13,7 +13,7 @@ import '../cache.dart';
import '../device.dart'; import '../device.dart';
import '../globals.dart'; import '../globals.dart';
import '../hot.dart'; import '../hot.dart';
import '../observatory.dart'; import '../vmservice.dart';
import '../resident_runner.dart'; import '../resident_runner.dart';
import '../run.dart'; import '../run.dart';
import '../runner/flutter_command.dart'; import '../runner/flutter_command.dart';
...@@ -275,7 +275,7 @@ Future<int> startApp( ...@@ -275,7 +275,7 @@ Future<int> startApp(
printError('Error running application on ${device.name}.'); printError('Error running application on ${device.name}.');
} else if (traceStartup) { } else if (traceStartup) {
try { try {
Observatory observatory = await Observatory.connect(result.observatoryPort); VMService observatory = await VMService.connect(result.observatoryPort);
await downloadStartupTrace(observatory); await downloadStartupTrace(observatory);
} catch (error) { } catch (error) {
printError('Error downloading trace from observatory: $error'); printError('Error downloading trace from observatory: $error');
......
...@@ -10,7 +10,7 @@ import '../base/common.dart'; ...@@ -10,7 +10,7 @@ import '../base/common.dart';
import '../base/utils.dart'; import '../base/utils.dart';
import '../cache.dart'; import '../cache.dart';
import '../globals.dart'; import '../globals.dart';
import '../observatory.dart'; import '../vmservice.dart';
import '../runner/flutter_command.dart'; import '../runner/flutter_command.dart';
// Names of some of the Timeline events we care about. // Names of some of the Timeline events we care about.
...@@ -98,10 +98,10 @@ class Tracing { ...@@ -98,10 +98,10 @@ class Tracing {
Tracing(this.observatory); Tracing(this.observatory);
static Future<Tracing> connect(int port) { 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 { Future<Null> startTracing() async {
await observatory.setVMTimelineFlags(<String>['Compiler', 'Dart', 'Embedder', 'GC']); await observatory.setVMTimelineFlags(<String>['Compiler', 'Dart', 'Embedder', 'GC']);
...@@ -153,7 +153,7 @@ class Tracing { ...@@ -153,7 +153,7 @@ class Tracing {
/// Download the startup trace information from the given observatory client and /// Download the startup trace information from the given observatory client and
/// store it to build/start_up_info.json. /// 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'); File traceInfoFile = new File('build/start_up_info.json');
if (await traceInfoFile.exists()) if (await traceInfoFile.exists())
......
...@@ -12,7 +12,7 @@ import 'base/logger.dart'; ...@@ -12,7 +12,7 @@ import 'base/logger.dart';
import 'dart/package_map.dart'; import 'dart/package_map.dart';
import 'asset.dart'; import 'asset.dart';
import 'globals.dart'; import 'globals.dart';
import 'observatory.dart'; import 'vmservice.dart';
typedef void DevFSProgressReporter(int progress, int max); typedef void DevFSProgressReporter(int progress, int max);
...@@ -108,7 +108,7 @@ abstract class DevFSOperations { ...@@ -108,7 +108,7 @@ abstract class DevFSOperations {
/// An implementation of [DevFSOperations] that speaks to the /// An implementation of [DevFSOperations] that speaks to the
/// service protocol. /// service protocol.
class ServiceProtocolDevFSOperations implements DevFSOperations { class ServiceProtocolDevFSOperations implements DevFSOperations {
final Observatory serviceProtocol; final VMService serviceProtocol;
ServiceProtocolDevFSOperations(this.serviceProtocol); ServiceProtocolDevFSOperations(this.serviceProtocol);
...@@ -165,7 +165,7 @@ class ServiceProtocolDevFSOperations implements DevFSOperations { ...@@ -165,7 +165,7 @@ class ServiceProtocolDevFSOperations implements DevFSOperations {
} }
class _DevFSHttpWriter { class _DevFSHttpWriter {
_DevFSHttpWriter(this.fsName, Observatory serviceProtocol) _DevFSHttpWriter(this.fsName, VMService serviceProtocol)
: httpAddress = serviceProtocol.httpAddress; : httpAddress = serviceProtocol.httpAddress;
final String fsName; final String fsName;
...@@ -230,7 +230,7 @@ class _DevFSHttpWriter { ...@@ -230,7 +230,7 @@ class _DevFSHttpWriter {
class DevFS { class DevFS {
/// Create a [DevFS] named [fsName] for the local files in [directory]. /// Create a [DevFS] named [fsName] for the local files in [directory].
DevFS(Observatory serviceProtocol, DevFS(VMService serviceProtocol,
String fsName, String fsName,
this.rootDirectory) this.rootDirectory)
: _operations = new ServiceProtocolDevFSOperations(serviceProtocol), : _operations = new ServiceProtocolDevFSOperations(serviceProtocol),
......
...@@ -13,7 +13,7 @@ import 'base/os.dart'; ...@@ -13,7 +13,7 @@ import 'base/os.dart';
import 'base/utils.dart'; import 'base/utils.dart';
import 'build_info.dart'; import 'build_info.dart';
import 'globals.dart'; import 'globals.dart';
import 'observatory.dart'; import 'vmservice.dart';
import 'ios/devices.dart'; import 'ios/devices.dart';
import 'ios/simulators.dart'; import 'ios/simulators.dart';
...@@ -209,7 +209,7 @@ abstract class Device { ...@@ -209,7 +209,7 @@ abstract class Device {
ApplicationPackage package, ApplicationPackage package,
LaunchResult result, { LaunchResult result, {
String mainPath, String mainPath,
Observatory observatory VMService observatory
}) async { }) async {
throw 'unsupported'; throw 'unsupported';
} }
......
...@@ -20,7 +20,7 @@ import 'dart/package_map.dart'; ...@@ -20,7 +20,7 @@ import 'dart/package_map.dart';
import 'device.dart'; import 'device.dart';
import 'globals.dart'; import 'globals.dart';
import 'devfs.dart'; import 'devfs.dart';
import 'observatory.dart'; import 'vmservice.dart';
import 'resident_runner.dart'; import 'resident_runner.dart';
import 'toolchain.dart'; import 'toolchain.dart';
import 'view.dart'; import 'view.dart';
...@@ -108,7 +108,7 @@ class FirstFrameTimer { ...@@ -108,7 +108,7 @@ class FirstFrameTimer {
return stopwatch.elapsed; return stopwatch.elapsed;
} }
final Observatory serviceProtocol; final VMService serviceProtocol;
final Stopwatch stopwatch = new Stopwatch(); final Stopwatch stopwatch = new Stopwatch();
final Completer<Null> _completer = new Completer<Null>(); final Completer<Null> _completer = new Completer<Null>();
StreamSubscription<Event> _subscription; StreamSubscription<Event> _subscription;
......
...@@ -12,7 +12,7 @@ import '../base/process.dart'; ...@@ -12,7 +12,7 @@ import '../base/process.dart';
import '../build_info.dart'; import '../build_info.dart';
import '../device.dart'; import '../device.dart';
import '../globals.dart'; import '../globals.dart';
import '../observatory.dart'; import '../vmservice.dart';
import '../protocol_discovery.dart'; import '../protocol_discovery.dart';
import 'mac.dart'; import 'mac.dart';
...@@ -328,7 +328,7 @@ class IOSDevice extends Device { ...@@ -328,7 +328,7 @@ class IOSDevice extends Device {
ApplicationPackage package, ApplicationPackage package,
LaunchResult result, { LaunchResult result, {
String mainPath, String mainPath,
Observatory observatory VMService observatory
}) async { }) async {
throw 'unsupported'; throw 'unsupported';
} }
......
...@@ -11,7 +11,7 @@ import 'base/logger.dart'; ...@@ -11,7 +11,7 @@ import 'base/logger.dart';
import 'build_info.dart'; import 'build_info.dart';
import 'device.dart'; import 'device.dart';
import 'globals.dart'; import 'globals.dart';
import 'observatory.dart'; import 'vmservice.dart';
import 'view.dart'; import 'view.dart';
// Shared code between different resident application runners. // Shared code between different resident application runners.
...@@ -28,7 +28,7 @@ abstract class ResidentRunner { ...@@ -28,7 +28,7 @@ abstract class ResidentRunner {
final bool usesTerminalUI; final bool usesTerminalUI;
final Completer<int> _finished = new Completer<int>(); final Completer<int> _finished = new Completer<int>();
Observatory serviceProtocol; VMService serviceProtocol;
ViewManager viewManager; ViewManager viewManager;
StreamSubscription<String> _loggingSubscription; StreamSubscription<String> _loggingSubscription;
...@@ -89,7 +89,7 @@ abstract class ResidentRunner { ...@@ -89,7 +89,7 @@ abstract class ResidentRunner {
if (!debuggingOptions.debuggingEnabled) { if (!debuggingOptions.debuggingEnabled) {
return new Future<Null>.error('Error the service protocol is not enabled.'); 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'); printTrace('Connected to service protocol on port $port');
serviceProtocol.populateIsolateInfo(); serviceProtocol.populateIsolateInfo();
serviceProtocol.onExtensionEvent.listen((Event event) { serviceProtocol.onExtensionEvent.listen((Event event) {
......
...@@ -13,7 +13,7 @@ import 'commands/install.dart'; ...@@ -13,7 +13,7 @@ import 'commands/install.dart';
import 'commands/trace.dart'; import 'commands/trace.dart';
import 'device.dart'; import 'device.dart';
import 'globals.dart'; import 'globals.dart';
import 'observatory.dart'; import 'vmservice.dart';
import 'resident_runner.dart'; import 'resident_runner.dart';
class RunAndStayResident extends ResidentRunner { class RunAndStayResident extends ResidentRunner {
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
import 'dart:async'; import 'dart:async';
import 'globals.dart'; import 'globals.dart';
import 'observatory.dart'; import 'vmservice.dart';
/// Peered to a Android/iOS FlutterView widget on a device. /// Peered to a Android/iOS FlutterView widget on a device.
class FlutterView { class FlutterView {
...@@ -41,7 +41,7 @@ class FlutterView { ...@@ -41,7 +41,7 @@ class FlutterView {
class ViewManager { class ViewManager {
ViewManager(this.serviceProtocol); ViewManager(this.serviceProtocol);
final Observatory serviceProtocol; final VMService serviceProtocol;
Future<Null> refresh() async { Future<Null> refresh() async {
List<Map<String, String>> viewList = await serviceProtocol.getViewList(); List<Map<String, String>> viewList = await serviceProtocol.getViewList();
......
...@@ -12,8 +12,8 @@ import 'package:web_socket_channel/io.dart'; ...@@ -12,8 +12,8 @@ import 'package:web_socket_channel/io.dart';
import 'globals.dart'; import 'globals.dart';
// TODO(johnmccutchan): Rename this class to ServiceProtocol or VmService. // TODO(johnmccutchan): Rename this class to ServiceProtocol or VmService.
class Observatory { class VMService {
Observatory._(this.peer, this.port, this.httpAddress) { VMService._(this.peer, this.port, this.httpAddress) {
peer.registerMethod('streamNotify', (rpc.Parameters event) { peer.registerMethod('streamNotify', (rpc.Parameters event) {
_handleStreamNotify(event.asMap); _handleStreamNotify(event.asMap);
}); });
...@@ -28,13 +28,13 @@ class Observatory { ...@@ -28,13 +28,13 @@ class Observatory {
}); });
} }
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'); Uri uri = new Uri(scheme: 'ws', host: '127.0.0.1', port: port, path: 'ws');
WebSocket ws = await WebSocket.connect(uri.toString()); WebSocket ws = await WebSocket.connect(uri.toString());
rpc.Peer peer = new rpc.Peer(new IOWebSocketChannel(ws)); rpc.Peer peer = new rpc.Peer(new IOWebSocketChannel(ws));
peer.listen(); peer.listen();
Uri httpAddress = new Uri(scheme: 'http', host: '127.0.0.1', port: port); 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 Uri httpAddress;
final rpc.Peer peer; final rpc.Peer peer;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment