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 /// The owner of this [ServiceObject]. This can be an [Isolate], a | 10 /// The owner of this [ServiceObject]. This can be an [Isolate], a |
(...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
727 class ServiceMap extends ServiceObject implements ObservableMap { | 727 class ServiceMap extends ServiceObject implements ObservableMap { |
728 final ObservableMap _map = new ObservableMap(); | 728 final ObservableMap _map = new ObservableMap(); |
729 static String objectIdRingPrefix = 'objects/'; | 729 static String objectIdRingPrefix = 'objects/'; |
730 | 730 |
731 bool get canCache { | 731 bool get canCache { |
732 return (_serviceType == 'Class' || | 732 return (_serviceType == 'Class' || |
733 _serviceType == 'Function' || | 733 _serviceType == 'Function' || |
734 _serviceType == 'Library') && | 734 _serviceType == 'Library') && |
735 !_id.startsWith(objectIdRingPrefix); | 735 !_id.startsWith(objectIdRingPrefix); |
736 } | 736 } |
737 bool get immutable => canCache; | 737 bool get immutable => canCache && (_serviceType != 'Function'); |
738 | 738 |
739 ServiceMap._empty(ServiceObjectOwner owner) : super._empty(owner); | 739 ServiceMap._empty(ServiceObjectOwner owner) : super._empty(owner); |
740 | 740 |
741 String toString() => _map.toString(); | 741 String toString() => _map.toString(); |
742 | 742 |
743 void _upgradeValues() { | 743 void _upgradeValues() { |
744 assert(owner != null); | 744 assert(owner != null); |
745 _upgradeCollection(_map, owner); | 745 _upgradeCollection(_map, owner); |
746 } | 746 } |
747 | 747 |
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1254 var v = list[i]; | 1254 var v = list[i]; |
1255 if ((v is ObservableMap) && _isServiceMap(v)) { | 1255 if ((v is ObservableMap) && _isServiceMap(v)) { |
1256 list[i] = owner.getFromMap(v); | 1256 list[i] = owner.getFromMap(v); |
1257 } else if (v is ObservableList) { | 1257 } else if (v is ObservableList) { |
1258 _upgradeObservableList(v, owner); | 1258 _upgradeObservableList(v, owner); |
1259 } else if (v is ObservableMap) { | 1259 } else if (v is ObservableMap) { |
1260 _upgradeObservableMap(v, owner); | 1260 _upgradeObservableMap(v, owner); |
1261 } | 1261 } |
1262 } | 1262 } |
1263 } | 1263 } |
OLD | NEW |