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