| 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 return this; | 89 return this; |
| 90 } | 90 } |
| 91 | 91 |
| 92 // update internal state from [map]. [map] can be a reference. | 92 // update internal state from [map]. [map] can be a reference. |
| 93 void _update(ObservableMap map); | 93 void _update(ObservableMap map); |
| 94 | 94 |
| 95 /// Returns true if [this] has only been partially initialized via | 95 /// Returns true if [this] has only been partially initialized via |
| 96 /// a reference. See [load]. | 96 /// a reference. See [load]. |
| 97 bool isRef() => _ref; | 97 bool isRef() => _ref; |
| 98 | 98 |
| 99 // Disabled by default because the logging is excessive. |
| 100 static bool _traceServiceObjectCreation = false; |
| 99 void _created() { | 101 void _created() { |
| 100 var refNotice = _ref ? ' Created from reference.' : ''; | 102 if (_traceServiceObjectCreation) { |
| 101 Logger.root.info('Created ServiceObject for \'${_id}\' with type ' | 103 var refNotice = _ref ? ' Created from reference.' : ''; |
| 102 '\'${_serviceType}\'.' + refNotice); | 104 Logger.root.info('Created ServiceObject for \'${_id}\' with type ' |
| 105 '\'${_serviceType}\'.' + refNotice); |
| 106 } |
| 103 } | 107 } |
| 104 | 108 |
| 105 /// Returns true if [map] is a service map. i.e. it has the following keys: | 109 /// Returns true if [map] is a service map. i.e. it has the following keys: |
| 106 /// 'id' and a 'type'. | 110 /// 'id' and a 'type'. |
| 107 static bool isServiceMap(ObservableMap m) { | 111 static bool isServiceMap(ObservableMap m) { |
| 108 return (m != null) && (m['id'] != null) && (m['type'] != null); | 112 return (m != null) && (m['id'] != null) && (m['type'] != null); |
| 109 } | 113 } |
| 110 | 114 |
| 111 /// Returns true if [type] is a reference type. i.e. it begins with an | 115 /// Returns true if [type] is a reference type. i.e. it begins with an |
| 112 /// '@' character. | 116 /// '@' character. |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 return isolate.codes.putIfAbsent(m); | 188 return isolate.codes.putIfAbsent(m); |
| 185 case 'Isolate': | 189 case 'Isolate': |
| 186 return vm.isolates.getIsolateFromMap(m); | 190 return vm.isolates.getIsolateFromMap(m); |
| 187 case 'Class': | 191 case 'Class': |
| 188 return isolate.classes.putIfAbsent(m); | 192 return isolate.classes.putIfAbsent(m); |
| 189 case 'Function': | 193 case 'Function': |
| 190 return isolate.functions.putIfAbsent(m); | 194 return isolate.functions.putIfAbsent(m); |
| 191 } | 195 } |
| 192 return new ServiceMap.fromMap(isolate, m); | 196 return new ServiceMap.fromMap(isolate, m); |
| 193 } | 197 } |
| OLD | NEW |