| 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 Isolate _isolate; | 10 Isolate _isolate; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 update(m); | 49 update(m); |
| 50 } | 50 } |
| 51 | 51 |
| 52 /// If [this] was created from a reference, load the full object | 52 /// If [this] was created from a reference, load the full object |
| 53 /// from the service by calling [reload]. Else, return [this]. | 53 /// from the service by calling [reload]. Else, return [this]. |
| 54 Future<ServiceObject> load() { | 54 Future<ServiceObject> load() { |
| 55 if (!_ref) { | 55 if (!_ref) { |
| 56 // Not a reference. | 56 // Not a reference. |
| 57 return new Future.value(this); | 57 return new Future.value(this); |
| 58 } | 58 } |
| 59 // Call refresh which will fill in the entire object. | 59 // Call reload which will fill in the entire object. |
| 60 return reload(); | 60 return reload(); |
| 61 } | 61 } |
| 62 | 62 |
| 63 /// Reload [this]. Returns a future which completes to [this] or | 63 /// Reload [this]. Returns a future which completes to [this] or |
| 64 /// a [ServiceError]. | 64 /// a [ServiceError]. |
| 65 Future<ServiceObject> reload() { | 65 Future<ServiceObject> reload() { |
| 66 assert(isolate != null); | 66 assert(isolate != null); |
| 67 if (id == '') { | 67 if (id == '') { |
| 68 // Errors don't have ids. | 68 // Errors don't have ids. |
| 69 assert(serviceType == 'Error'); | 69 assert(serviceType == 'Error'); |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 return isolate.scripts.putIfAbsent(m); | 178 return isolate.scripts.putIfAbsent(m); |
| 179 case 'Code': | 179 case 'Code': |
| 180 return isolate.codes.putIfAbsent(m); | 180 return isolate.codes.putIfAbsent(m); |
| 181 case 'Isolate': | 181 case 'Isolate': |
| 182 return vm.isolates.getIsolateFromMap(m); | 182 return vm.isolates.getIsolateFromMap(m); |
| 183 case 'Class': | 183 case 'Class': |
| 184 return isolate.classes.putIfAbsent(m); | 184 return isolate.classes.putIfAbsent(m); |
| 185 } | 185 } |
| 186 return new ServiceMap.fromMap(isolate, m); | 186 return new ServiceMap.fromMap(isolate, m); |
| 187 } | 187 } |
| OLD | NEW |