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 712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
723 class ServiceMap extends ServiceObject implements ObservableMap { | 723 class ServiceMap extends ServiceObject implements ObservableMap { |
724 final ObservableMap _map = new ObservableMap(); | 724 final ObservableMap _map = new ObservableMap(); |
725 static String objectIdRingPrefix = 'objects/'; | 725 static String objectIdRingPrefix = 'objects/'; |
726 | 726 |
727 bool get canCache { | 727 bool get canCache { |
728 return (_serviceType == 'Class' || | 728 return (_serviceType == 'Class' || |
729 _serviceType == 'Function' || | 729 _serviceType == 'Function' || |
730 _serviceType == 'Library') && | 730 _serviceType == 'Library') && |
731 !_id.startsWith(objectIdRingPrefix); | 731 !_id.startsWith(objectIdRingPrefix); |
732 } | 732 } |
733 bool get immutable => canCache; | 733 bool get immutable => canCache && (_serviceType != 'Function'); |
734 | 734 |
735 ServiceMap._empty(ServiceObjectOwner owner) : super._empty(owner); | 735 ServiceMap._empty(ServiceObjectOwner owner) : super._empty(owner); |
736 | 736 |
737 String toString() => _map.toString(); | 737 String toString() => _map.toString(); |
738 | 738 |
739 void _upgradeValues() { | 739 void _upgradeValues() { |
740 assert(owner != null); | 740 assert(owner != null); |
741 _upgradeCollection(_map, owner); | 741 _upgradeCollection(_map, owner); |
742 } | 742 } |
743 | 743 |
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1250 var v = list[i]; | 1250 var v = list[i]; |
1251 if ((v is ObservableMap) && _isServiceMap(v)) { | 1251 if ((v is ObservableMap) && _isServiceMap(v)) { |
1252 list[i] = owner.getFromMap(v); | 1252 list[i] = owner.getFromMap(v); |
1253 } else if (v is ObservableList) { | 1253 } else if (v is ObservableList) { |
1254 _upgradeObservableList(v, owner); | 1254 _upgradeObservableList(v, owner); |
1255 } else if (v is ObservableMap) { | 1255 } else if (v is ObservableMap) { |
1256 _upgradeObservableMap(v, owner); | 1256 _upgradeObservableMap(v, owner); |
1257 } | 1257 } |
1258 } | 1258 } |
1259 } | 1259 } |
OLD | NEW |