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 // Some value smaller than the object ring, so requesting a large array | 7 // Some value smaller than the object ring, so requesting a large array |
8 // doesn't result in an expired ref because the elements lapped it in the | 8 // doesn't result in an expired ref because the elements lapped it in the |
9 // object ring. | 9 // object ring. |
10 const int kDefaultFieldLimit = 100; | 10 const int kDefaultFieldLimit = 100; |
(...skipping 758 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
769 if (map == null) { | 769 if (map == null) { |
770 return null; | 770 return null; |
771 } | 771 } |
772 var type = _stripRef(map['type']); | 772 var type = _stripRef(map['type']); |
773 if (type == 'VM') { | 773 if (type == 'VM') { |
774 // Update this VM object. | 774 // Update this VM object. |
775 update(map); | 775 update(map); |
776 return this; | 776 return this; |
777 } | 777 } |
778 | 778 |
| 779 assert(type == 'Isolate'); |
779 String id = map['id']; | 780 String id = map['id']; |
780 if ((id != null) && id.startsWith(_isolateIdPrefix)) { | 781 if (!id.startsWith(_isolateIdPrefix)) { |
781 // Check cache. | 782 // Currently the VM only supports upgrading Isolate ServiceObjects. |
782 var isolate = _isolateCache[id]; | 783 throw new UnimplementedError(); |
783 if (isolate == null) { | |
784 // Add new isolate to the cache. | |
785 isolate = new ServiceObject._fromMap(this, map); | |
786 _isolateCache[id] = isolate; | |
787 _buildIsolateList(); | |
788 | |
789 // Eagerly load the isolate. | |
790 isolate.load().catchError((e, stack) { | |
791 Logger.root.info('Eagerly loading an isolate failed: $e\n$stack'); | |
792 }); | |
793 } else { | |
794 isolate.update(map); | |
795 } | |
796 return isolate; | |
797 } | 784 } |
798 | 785 |
799 // Build the object from the map directly. | 786 // Check cache. |
800 return new ServiceObject._fromMap(this, map); | 787 var isolate = _isolateCache[id]; |
| 788 if (isolate == null) { |
| 789 // Add new isolate to the cache. |
| 790 isolate = new ServiceObject._fromMap(this, map); |
| 791 _isolateCache[id] = isolate; |
| 792 _buildIsolateList(); |
| 793 |
| 794 // Eagerly load the isolate. |
| 795 isolate.load().catchError((e, stack) { |
| 796 Logger.root.info('Eagerly loading an isolate failed: $e\n$stack'); |
| 797 }); |
| 798 } else { |
| 799 isolate.update(map); |
| 800 } |
| 801 return isolate; |
801 } | 802 } |
802 | 803 |
803 // Note that this function does not reload the isolate if it found | 804 // Note that this function does not reload the isolate if it found |
804 // in the cache. | 805 // in the cache. |
805 Future<ServiceObject> getIsolate(String isolateId) { | 806 Future<ServiceObject> getIsolate(String isolateId) { |
806 if (!loaded) { | 807 if (!loaded) { |
807 // Trigger a VM load, then get the isolate. | 808 // Trigger a VM load, then get the isolate. |
808 return load().then((_) => getIsolate(isolateId)).catchError(_ignoreError); | 809 return load().then((_) => getIsolate(isolateId)).catchError(_ignoreError); |
809 } | 810 } |
810 return new Future.value(_isolateCache[isolateId]); | 811 return new Future.value(_isolateCache[isolateId]); |
(...skipping 2190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3001 bool isDart; | 3002 bool isDart; |
3002 ProfileFunction profile; | 3003 ProfileFunction profile; |
3003 Instance icDataArray; | 3004 Instance icDataArray; |
3004 Field field; | 3005 Field field; |
3005 | 3006 |
3006 bool get immutable => false; | 3007 bool get immutable => false; |
3007 | 3008 |
3008 ServiceFunction._empty(ServiceObject owner) : super._empty(owner); | 3009 ServiceFunction._empty(ServiceObject owner) : super._empty(owner); |
3009 | 3010 |
3010 void _update(Map map, bool mapIsRef) { | 3011 void _update(Map map, bool mapIsRef) { |
3011 _upgradeCollection(map, owner); | 3012 _upgradeCollection(map, isolate); |
3012 super._update(map, mapIsRef); | 3013 super._update(map, mapIsRef); |
3013 | 3014 |
3014 name = map['name']; | 3015 name = map['name']; |
3015 vmName = (map.containsKey('_vmName') ? map['_vmName'] : name); | 3016 vmName = (map.containsKey('_vmName') ? map['_vmName'] : name); |
3016 | 3017 |
3017 dartOwner = map['owner']; | 3018 dartOwner = map['owner']; |
3018 kind = stringToFunctionKind(map['_kind']); | 3019 kind = stringToFunctionKind(map['_kind']); |
3019 isDart = M.isDartFunction(kind); | 3020 isDart = M.isDartFunction(kind); |
3020 | 3021 |
3021 if (dartOwner is ServiceFunction) { | 3022 if (dartOwner is ServiceFunction) { |
(...skipping 1601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4623 var v = list[i]; | 4624 var v = list[i]; |
4624 if ((v is Map) && _isServiceMap(v)) { | 4625 if ((v is Map) && _isServiceMap(v)) { |
4625 list[i] = owner.getFromMap(v); | 4626 list[i] = owner.getFromMap(v); |
4626 } else if (v is List) { | 4627 } else if (v is List) { |
4627 _upgradeList(v, owner); | 4628 _upgradeList(v, owner); |
4628 } else if (v is Map) { | 4629 } else if (v is Map) { |
4629 _upgradeMap(v, owner); | 4630 _upgradeMap(v, owner); |
4630 } | 4631 } |
4631 } | 4632 } |
4632 } | 4633 } |
OLD | NEW |