| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 part of repositories; | 5 part of repositories; |
| 6 | 6 |
| 7 typedef bool IsConnectedVMTargetDelegate(Target); | 7 typedef bool IsConnectedVMTargetDelegate(Target); |
| 8 | 8 |
| 9 class TargetChangeEvent implements M.TargetChangeEvent { | 9 class TargetChangeEvent implements M.TargetChangeEvent { |
| 10 final TargetRepository repository; | 10 final TargetRepository repository; |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 SC.WebSocketVMTarget find(String networkAddress) { | 100 SC.WebSocketVMTarget find(String networkAddress) { |
| 101 for (SC.WebSocketVMTarget item in _list) { | 101 for (SC.WebSocketVMTarget item in _list) { |
| 102 if (item.networkAddress == networkAddress) { | 102 if (item.networkAddress == networkAddress) { |
| 103 return item; | 103 return item; |
| 104 } | 104 } |
| 105 } | 105 } |
| 106 return null; | 106 return null; |
| 107 } | 107 } |
| 108 | 108 |
| 109 static String _networkAddressOfDefaultTarget() { | 109 static String _networkAddressOfDefaultTarget() { |
| 110 if (!identical(1, 1.0)) { | 110 // It is possible to override the default port and host by adding extra |
| 111 // Dartium, assume we are developing. | 111 // query parameters: |
| 112 return 'ws://127.0.0.1:8181/ws'; | 112 // http://localhost:8080?override-port=8181 |
| 113 } | 113 // http://localhost:8080?override-port=8181&override-host=10.0.0.2 |
| 114 Uri serverAddress = Uri.parse(window.location.toString()); | 114 final Uri serverAddress = Uri.parse(window.location.toString()); |
| 115 return 'ws://${serverAddress.authority}${serverAddress.path}ws'; | 115 final String port = serverAddress.queryParameters['override-port']; |
| 116 final String host = serverAddress.queryParameters['override-host']; |
| 117 final Uri wsAddress = new Uri( |
| 118 scheme: 'ws', |
| 119 host: host ?? serverAddress.host, |
| 120 port: int.parse(port ?? '', onError: (_) => null), |
| 121 path: '/ws', |
| 122 ); |
| 123 return wsAddress.toString(); |
| 116 } | 124 } |
| 117 | 125 |
| 118 bool isConnectedVMTarget(M.Target target) => _isConnectedVMTarget(target); | 126 bool isConnectedVMTarget(M.Target target) => _isConnectedVMTarget(target); |
| 119 } | 127 } |
| OLD | NEW |