Consolidate observatory code (#3892) * rename service_protocol.dart to protocol_discovery.dart * add a wrapper around the obs. protocol * use json-rpc in run * consolidate obs. code; implement flutter run --benchmark * review comments
diff --git a/packages/flutter_tools/lib/src/ios/simulators.dart b/packages/flutter_tools/lib/src/ios/simulators.dart index 2494cc9..02e47b1 100644 --- a/packages/flutter_tools/lib/src/ios/simulators.dart +++ b/packages/flutter_tools/lib/src/ios/simulators.dart
@@ -15,7 +15,7 @@ import '../device.dart'; import '../flx.dart' as flx; import '../globals.dart'; -import '../service_protocol.dart'; +import '../protocol_discovery.dart'; import 'mac.dart'; const String _xcrunPath = '/usr/bin/xcrun'; @@ -395,20 +395,17 @@ RegExp versionExp = new RegExp(r'iPhone ([0-9])+'); Match match = versionExp.firstMatch(name); - if (match == null) { - // Not an iPhone. All available non-iPhone simulators are compatible. + // Not an iPhone. All available non-iPhone simulators are compatible. + if (match == null) return true; - } - if (int.parse(match.group(1)) > 5) { - // iPhones 6 and above are always fine. + // iPhones 6 and above are always fine. + if (int.parse(match.group(1)) > 5) return true; - } // The 's' subtype of 5 is compatible. - if (name.contains('iPhone 5s')) { + if (name.contains('iPhone 5s')) return true; - } _supportMessage = "The simulator version is too old. Choose an iPhone 5s or above."; return false; @@ -447,12 +444,10 @@ if (!(await _setupUpdatedApplicationBundle(app))) return new LaunchResult.failed(); - ServiceProtocolDiscovery observatoryDiscovery; + ProtocolDiscovery observatoryDiscovery; - if (debuggingOptions.debuggingEnabled) { - observatoryDiscovery = new ServiceProtocolDiscovery( - logReader, ServiceProtocolDiscovery.kObservatoryService); - } + if (debuggingOptions.debuggingEnabled) + observatoryDiscovery = new ProtocolDiscovery(logReader, ProtocolDiscovery.kObservatoryService); // Prepare launch arguments. List<String> args = <String>[