| 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] represents a persistent object within the vm. | 7 /// A [ServiceObject] represents a persistent object within the vm. |
| 8 abstract class ServiceObject extends Observable { | 8 abstract class ServiceObject extends Observable { |
| 9 static int LexicalSortName(ServiceObject o1, ServiceObject o2) { | 9 static int LexicalSortName(ServiceObject o1, ServiceObject o2) { |
| 10 return o1.name.compareTo(o2.name); | 10 return o1.name.compareTo(o2.name); |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 _vmType = _stripRef(map['_vmType']); | 274 _vmType = _stripRef(map['_vmType']); |
| 275 } else { | 275 } else { |
| 276 _vmType = _type; | 276 _vmType = _type; |
| 277 } | 277 } |
| 278 | 278 |
| 279 _update(map, mapIsRef); | 279 _update(map, mapIsRef); |
| 280 } | 280 } |
| 281 | 281 |
| 282 // Updates internal state from [map]. [map] can be a reference. | 282 // Updates internal state from [map]. [map] can be a reference. |
| 283 void _update(ObservableMap map, bool mapIsRef); | 283 void _update(ObservableMap map, bool mapIsRef); |
| 284 |
| 285 // Helper that can be passed to .catchError that ignores the error. |
| 286 _ignoreError(error, stackTrace) { |
| 287 // do nothing. |
| 288 } |
| 284 } | 289 } |
| 285 | 290 |
| 286 abstract class Coverage { | 291 abstract class Coverage { |
| 287 // Following getters and functions will be provided by [ServiceObject]. | 292 // Following getters and functions will be provided by [ServiceObject]. |
| 288 String get id; | 293 String get id; |
| 289 Isolate get isolate; | 294 Isolate get isolate; |
| 290 | 295 |
| 291 /// Default handler for coverage data. | 296 /// Default handler for coverage data. |
| 292 void processCoverageData(List coverageData) { | 297 void processCoverageData(List coverageData) { |
| 293 coverageData.forEach((scriptCoverage) { | 298 coverageData.forEach((scriptCoverage) { |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 498 if (isolate == null) { | 503 if (isolate == null) { |
| 499 // We should never see an unknown isolate here. | 504 // We should never see an unknown isolate here. |
| 500 throw new UnimplementedError(); | 505 throw new UnimplementedError(); |
| 501 } | 506 } |
| 502 return isolate; | 507 return isolate; |
| 503 } | 508 } |
| 504 | 509 |
| 505 // Note that this function does not reload the isolate if it found | 510 // Note that this function does not reload the isolate if it found |
| 506 // in the cache. | 511 // in the cache. |
| 507 Future<ServiceObject> getIsolate(String isolateId) { | 512 Future<ServiceObject> getIsolate(String isolateId) { |
| 513 if (!loaded) { |
| 514 // Trigger a VM load, then get the isolate. |
| 515 return load().then((_) => getIsolate(isolateId)).catchError(_ignoreError); |
| 516 } |
| 508 return new Future.value(_isolateCache[isolateId]); | 517 return new Future.value(_isolateCache[isolateId]); |
| 509 } | 518 } |
| 510 | 519 |
| 511 dynamic _reviver(dynamic key, dynamic value) { | 520 dynamic _reviver(dynamic key, dynamic value) { |
| 512 return value; | 521 return value; |
| 513 } | 522 } |
| 514 | 523 |
| 515 ObservableMap _parseJSON(String response) { | 524 ObservableMap _parseJSON(String response) { |
| 516 var map; | 525 var map; |
| 517 try { | 526 try { |
| (...skipping 2291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2809 var v = list[i]; | 2818 var v = list[i]; |
| 2810 if ((v is ObservableMap) && _isServiceMap(v)) { | 2819 if ((v is ObservableMap) && _isServiceMap(v)) { |
| 2811 list[i] = owner.getFromMap(v); | 2820 list[i] = owner.getFromMap(v); |
| 2812 } else if (v is ObservableList) { | 2821 } else if (v is ObservableList) { |
| 2813 _upgradeObservableList(v, owner); | 2822 _upgradeObservableList(v, owner); |
| 2814 } else if (v is ObservableMap) { | 2823 } else if (v is ObservableMap) { |
| 2815 _upgradeObservableMap(v, owner); | 2824 _upgradeObservableMap(v, owner); |
| 2816 } | 2825 } |
| 2817 } | 2826 } |
| 2818 } | 2827 } |
| OLD | NEW |