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 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 'message': 'Could not decode JSON: $e', | 408 'message': 'Could not decode JSON: $e', |
409 }))); | 409 }))); |
410 } | 410 } |
411 | 411 |
412 /// Gets [id] as an [ObservableMap] from the service directly. If | 412 /// Gets [id] as an [ObservableMap] from the service directly. If |
413 /// an error occurs, the future is completed as an error with a | 413 /// an error occurs, the future is completed as an error with a |
414 /// ServiceError or ServiceException. Therefore any chained then() calls | 414 /// ServiceError or ServiceException. Therefore any chained then() calls |
415 /// will only receive a map encoding a valid ServiceObject. | 415 /// will only receive a map encoding a valid ServiceObject. |
416 Future<ObservableMap> getAsMap(String id) { | 416 Future<ObservableMap> getAsMap(String id) { |
417 return getString(id).then((response) { | 417 return getString(id).then((response) { |
418 print("GOT $response"); | |
419 var map = _parseJSON(response); | 418 var map = _parseJSON(response); |
420 return _processMap(map); | 419 return _processMap(map); |
421 }).catchError((error) { | 420 }).catchError((error) { |
422 // ServiceError, forward to VM's ServiceError stream. | 421 // ServiceError, forward to VM's ServiceError stream. |
423 errors.add(error); | 422 errors.add(error); |
424 return new Future.error(error); | 423 return new Future.error(error); |
425 }, test: (e) => e is ServiceError).catchError((exception) { | 424 }, test: (e) => e is ServiceError).catchError((exception) { |
426 // ServiceException, forward to VM's ServiceException stream. | 425 // ServiceException, forward to VM's ServiceException stream. |
427 exceptions.add(exception); | 426 exceptions.add(exception); |
428 return new Future.error(exception); | 427 return new Future.error(exception); |
(...skipping 1805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2234 var v = list[i]; | 2233 var v = list[i]; |
2235 if ((v is ObservableMap) && _isServiceMap(v)) { | 2234 if ((v is ObservableMap) && _isServiceMap(v)) { |
2236 list[i] = owner.getFromMap(v); | 2235 list[i] = owner.getFromMap(v); |
2237 } else if (v is ObservableList) { | 2236 } else if (v is ObservableList) { |
2238 _upgradeObservableList(v, owner); | 2237 _upgradeObservableList(v, owner); |
2239 } else if (v is ObservableMap) { | 2238 } else if (v is ObservableMap) { |
2240 _upgradeObservableMap(v, owner); | 2239 _upgradeObservableMap(v, owner); |
2241 } | 2240 } |
2242 } | 2241 } |
2243 } | 2242 } |
OLD | NEW |