| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 service; | 5 part of service; |
| 6 | 6 |
| 7 /// A [ServiceObject] is an object known to the VM service and is tied | 7 /// A [ServiceObject] is an object known to the VM service and is tied |
| 8 /// to an owning [Isolate]. | 8 /// to an owning [Isolate]. |
| 9 abstract class ServiceObject extends Observable { | 9 abstract class ServiceObject extends Observable { |
| 10 static int LexicalSortName(ServiceObject o1, ServiceObject o2) { | 10 static int LexicalSortName(ServiceObject o1, ServiceObject o2) { |
| (...skipping 1320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1331 @observable int hits; | 1331 @observable int hits; |
| 1332 ScriptLine(this.line, this.text); | 1332 ScriptLine(this.line, this.text); |
| 1333 } | 1333 } |
| 1334 | 1334 |
| 1335 class Script extends ServiceObject with Coverage { | 1335 class Script extends ServiceObject with Coverage { |
| 1336 final lines = new ObservableList<ScriptLine>(); | 1336 final lines = new ObservableList<ScriptLine>(); |
| 1337 final _hits = new Map<int, int>(); | 1337 final _hits = new Map<int, int>(); |
| 1338 @observable String kind; | 1338 @observable String kind; |
| 1339 @observable int firstTokenPos; | 1339 @observable int firstTokenPos; |
| 1340 @observable int lastTokenPos; | 1340 @observable int lastTokenPos; |
| 1341 @observable Library owningLibrary; |
| 1341 bool get canCache => true; | 1342 bool get canCache => true; |
| 1342 bool get immutable => true; | 1343 bool get immutable => true; |
| 1343 | 1344 |
| 1344 String _shortUrl; | 1345 String _shortUrl; |
| 1345 String _url; | 1346 String _url; |
| 1346 | 1347 |
| 1347 Script._empty(ServiceObjectOwner owner) : super._empty(owner); | 1348 Script._empty(ServiceObjectOwner owner) : super._empty(owner); |
| 1348 | 1349 |
| 1349 ScriptLine getLine(int line) { | 1350 ScriptLine getLine(int line) { |
| 1350 assert(line >= 1); | 1351 assert(line >= 1); |
| 1351 return lines[line - 1]; | 1352 return lines[line - 1]; |
| 1352 } | 1353 } |
| 1353 | 1354 |
| 1354 /// This function maps a token position to a line number. | 1355 /// This function maps a token position to a line number. |
| 1355 int tokenToLine(int token) => _tokenToLine[token]; | 1356 int tokenToLine(int token) => _tokenToLine[token]; |
| 1356 Map _tokenToLine = {}; | 1357 Map _tokenToLine = {}; |
| 1357 | 1358 |
| 1358 /// This function maps a token position to a column number. | 1359 /// This function maps a token position to a column number. |
| 1359 int tokenToCol(int token) => _tokenToCol[token]; | 1360 int tokenToCol(int token) => _tokenToCol[token]; |
| 1360 Map _tokenToCol = {}; | 1361 Map _tokenToCol = {}; |
| 1361 | 1362 |
| 1362 void _update(ObservableMap map, bool mapIsRef) { | 1363 void _update(ObservableMap map, bool mapIsRef) { |
| 1364 _upgradeCollection(map, isolate); |
| 1363 kind = map['kind']; | 1365 kind = map['kind']; |
| 1364 _url = map['name']; | 1366 _url = map['name']; |
| 1365 _shortUrl = _url.substring(_url.lastIndexOf('/') + 1); | 1367 _shortUrl = _url.substring(_url.lastIndexOf('/') + 1); |
| 1366 name = _shortUrl; | 1368 name = _shortUrl; |
| 1367 vmName = _url; | 1369 vmName = _url; |
| 1370 if (mapIsRef) { |
| 1371 return; |
| 1372 } |
| 1368 _processSource(map['source']); | 1373 _processSource(map['source']); |
| 1369 _parseTokenPosTable(map['tokenPosTable']); | 1374 _parseTokenPosTable(map['tokenPosTable']); |
| 1375 owningLibrary = map['owning_library']; |
| 1370 } | 1376 } |
| 1371 | 1377 |
| 1372 void _parseTokenPosTable(List<List<int>> table) { | 1378 void _parseTokenPosTable(List<List<int>> table) { |
| 1373 if (table == null) { | 1379 if (table == null) { |
| 1374 return; | 1380 return; |
| 1375 } | 1381 } |
| 1376 _tokenToLine.clear(); | 1382 _tokenToLine.clear(); |
| 1377 _tokenToCol.clear(); | 1383 _tokenToCol.clear(); |
| 1378 firstTokenPos = null; | 1384 firstTokenPos = null; |
| 1379 lastTokenPos = null; | 1385 lastTokenPos = null; |
| (...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2024 var v = list[i]; | 2030 var v = list[i]; |
| 2025 if ((v is ObservableMap) && _isServiceMap(v)) { | 2031 if ((v is ObservableMap) && _isServiceMap(v)) { |
| 2026 list[i] = owner.getFromMap(v); | 2032 list[i] = owner.getFromMap(v); |
| 2027 } else if (v is ObservableList) { | 2033 } else if (v is ObservableList) { |
| 2028 _upgradeObservableList(v, owner); | 2034 _upgradeObservableList(v, owner); |
| 2029 } else if (v is ObservableMap) { | 2035 } else if (v is ObservableMap) { |
| 2030 _upgradeObservableMap(v, owner); | 2036 _upgradeObservableMap(v, owner); |
| 2031 } | 2037 } |
| 2032 } | 2038 } |
| 2033 } | 2039 } |
| OLD | NEW |