Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(172)

Side by Side Diff: runtime/observatory/lib/src/service/object.dart

Issue 2748403002: Added page to Observatory to display native memory allocation information. (Closed)
Patch Set: Added page to Observatory to display native memory allocation information. Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 749 matching lines...) Expand 10 before | Expand all | Expand 10 after
760 if (map == null) { 760 if (map == null) {
761 return null; 761 return null;
762 } 762 }
763 var type = _stripRef(map['type']); 763 var type = _stripRef(map['type']);
764 if (type == 'VM') { 764 if (type == 'VM') {
765 // Update this VM object. 765 // Update this VM object.
766 update(map); 766 update(map);
767 return this; 767 return this;
768 } 768 }
769 769
770 assert(type == 'Isolate');
771 String id = map['id']; 770 String id = map['id'];
772 if (!id.startsWith(_isolateIdPrefix)) { 771 if ((id != null) && id.startsWith(_isolateIdPrefix)) {
773 // Currently the VM only supports upgrading Isolate ServiceObjects. 772 // Check cache.
774 throw new UnimplementedError(); 773 var isolate = _isolateCache[id];
774 if (isolate == null) {
775 // Add new isolate to the cache.
776 isolate = new ServiceObject._fromMap(this, map);
777 _isolateCache[id] = isolate;
778 _buildIsolateList();
779
780 // Eagerly load the isolate.
781 isolate.load().catchError((e, stack) {
782 Logger.root.info('Eagerly loading an isolate failed: $e\n$stack');
783 });
784 } else {
785 isolate.update(map);
786 }
787 return isolate;
775 } 788 }
776 789
777 // Check cache. 790 // Build the object from the map directly.
778 var isolate = _isolateCache[id]; 791 var obj = new ServiceObject._fromMap(this, map);
779 if (isolate == null) { 792 if ((id != null) && (obj != null) && obj.canCache) {
Cutch 2017/03/21 20:27:11 we shouldn't put things in the VM objects' cache h
bkonyi 2017/03/22 21:25:21 Done.
780 // Add new isolate to the cache. 793 _cache[id] = obj;
781 isolate = new ServiceObject._fromMap(this, map); 794 }
782 _isolateCache[id] = isolate; 795 return obj;
783 _buildIsolateList();
784 796
785 // Eagerly load the isolate.
786 isolate.load().catchError((e, stack) {
787 Logger.root.info('Eagerly loading an isolate failed: $e\n$stack');
788 });
789 } else {
790 isolate.update(map);
791 }
792 return isolate;
793 } 797 }
794 798
795 // Note that this function does not reload the isolate if it found 799 // Note that this function does not reload the isolate if it found
796 // in the cache. 800 // in the cache.
797 Future<ServiceObject> getIsolate(String isolateId) { 801 Future<ServiceObject> getIsolate(String isolateId) {
798 if (!loaded) { 802 if (!loaded) {
799 // Trigger a VM load, then get the isolate. 803 // Trigger a VM load, then get the isolate.
800 return load().then((_) => getIsolate(isolateId)).catchError(_ignoreError); 804 return load().then((_) => getIsolate(isolateId)).catchError(_ignoreError);
801 } 805 }
802 return new Future.value(_isolateCache[isolateId]); 806 return new Future.value(_isolateCache[isolateId]);
(...skipping 2198 matching lines...) Expand 10 before | Expand all | Expand 10 after
3001 bool isDart; 3005 bool isDart;
3002 ProfileFunction profile; 3006 ProfileFunction profile;
3003 Instance icDataArray; 3007 Instance icDataArray;
3004 Field field; 3008 Field field;
3005 3009
3006 bool get immutable => false; 3010 bool get immutable => false;
3007 3011
3008 ServiceFunction._empty(ServiceObject owner) : super._empty(owner); 3012 ServiceFunction._empty(ServiceObject owner) : super._empty(owner);
3009 3013
3010 void _update(Map map, bool mapIsRef) { 3014 void _update(Map map, bool mapIsRef) {
3011 _upgradeCollection(map, isolate); 3015 _upgradeCollection(map, owner);
3012 super._update(map, mapIsRef); 3016 super._update(map, mapIsRef);
3013 3017
3014 name = map['name']; 3018 name = map['name'];
3015 vmName = (map.containsKey('_vmName') ? map['_vmName'] : name); 3019 vmName = (map.containsKey('_vmName') ? map['_vmName'] : name);
3016 3020
3017 dartOwner = map['owner']; 3021 dartOwner = map['owner'];
3018 kind = stringToFunctionKind(map['_kind']); 3022 kind = stringToFunctionKind(map['_kind']);
3019 isDart = M.isDartFunction(kind); 3023 isDart = M.isDartFunction(kind);
3020 3024
3021 if (dartOwner is ServiceFunction) { 3025 if (dartOwner is ServiceFunction) {
(...skipping 1545 matching lines...) Expand 10 before | Expand all | Expand 10 after
4567 var v = list[i]; 4571 var v = list[i];
4568 if ((v is Map) && _isServiceMap(v)) { 4572 if ((v is Map) && _isServiceMap(v)) {
4569 list[i] = owner.getFromMap(v); 4573 list[i] = owner.getFromMap(v);
4570 } else if (v is List) { 4574 } else if (v is List) {
4571 _upgradeList(v, owner); 4575 _upgradeList(v, owner);
4572 } else if (v is Map) { 4576 } else if (v is Map) {
4573 _upgradeMap(v, owner); 4577 _upgradeMap(v, owner);
4574 } 4578 }
4575 } 4579 }
4576 } 4580 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698