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

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

Issue 2771293003: Resubmission of native memory allocation info surfacing in Observatory. Fixed crashing tests and st… (Closed)
Patch Set: Added page to Observatory to display native memory allocation information. Created 3 years, 8 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 758 matching lines...) Expand 10 before | Expand all | Expand 10 after
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');
780 String id = map['id']; 779 String id = map['id'];
781 if (!id.startsWith(_isolateIdPrefix)) { 780 if ((id != null) && id.startsWith(_isolateIdPrefix)) {
782 // Currently the VM only supports upgrading Isolate ServiceObjects. 781 // Check cache.
783 throw new UnimplementedError(); 782 var isolate = _isolateCache[id];
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;
784 } 797 }
785 798
786 // Check cache. 799 // Build the object from the map directly.
787 var isolate = _isolateCache[id]; 800 return new ServiceObject._fromMap(this, map);
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;
802 } 801 }
803 802
804 // Note that this function does not reload the isolate if it found 803 // Note that this function does not reload the isolate if it found
805 // in the cache. 804 // in the cache.
806 Future<ServiceObject> getIsolate(String isolateId) { 805 Future<ServiceObject> getIsolate(String isolateId) {
807 if (!loaded) { 806 if (!loaded) {
808 // Trigger a VM load, then get the isolate. 807 // Trigger a VM load, then get the isolate.
809 return load().then((_) => getIsolate(isolateId)).catchError(_ignoreError); 808 return load().then((_) => getIsolate(isolateId)).catchError(_ignoreError);
810 } 809 }
811 return new Future.value(_isolateCache[isolateId]); 810 return new Future.value(_isolateCache[isolateId]);
(...skipping 2190 matching lines...) Expand 10 before | Expand all | Expand 10 after
3002 bool isDart; 3001 bool isDart;
3003 ProfileFunction profile; 3002 ProfileFunction profile;
3004 Instance icDataArray; 3003 Instance icDataArray;
3005 Field field; 3004 Field field;
3006 3005
3007 bool get immutable => false; 3006 bool get immutable => false;
3008 3007
3009 ServiceFunction._empty(ServiceObject owner) : super._empty(owner); 3008 ServiceFunction._empty(ServiceObject owner) : super._empty(owner);
3010 3009
3011 void _update(Map map, bool mapIsRef) { 3010 void _update(Map map, bool mapIsRef) {
3012 _upgradeCollection(map, isolate); 3011 _upgradeCollection(map, owner);
3013 super._update(map, mapIsRef); 3012 super._update(map, mapIsRef);
3014 3013
3015 name = map['name']; 3014 name = map['name'];
3016 vmName = (map.containsKey('_vmName') ? map['_vmName'] : name); 3015 vmName = (map.containsKey('_vmName') ? map['_vmName'] : name);
3017 3016
3018 dartOwner = map['owner']; 3017 dartOwner = map['owner'];
3019 kind = stringToFunctionKind(map['_kind']); 3018 kind = stringToFunctionKind(map['_kind']);
3020 isDart = M.isDartFunction(kind); 3019 isDart = M.isDartFunction(kind);
3021 3020
3022 if (dartOwner is ServiceFunction) { 3021 if (dartOwner is ServiceFunction) {
(...skipping 1601 matching lines...) Expand 10 before | Expand all | Expand 10 after
4624 var v = list[i]; 4623 var v = list[i];
4625 if ((v is Map) && _isServiceMap(v)) { 4624 if ((v is Map) && _isServiceMap(v)) {
4626 list[i] = owner.getFromMap(v); 4625 list[i] = owner.getFromMap(v);
4627 } else if (v is List) { 4626 } else if (v is List) {
4628 _upgradeList(v, owner); 4627 _upgradeList(v, owner);
4629 } else if (v is Map) { 4628 } else if (v is Map) {
4630 _upgradeMap(v, owner); 4629 _upgradeMap(v, owner);
4631 } 4630 }
4632 } 4631 }
4633 } 4632 }
OLDNEW
« no previous file with comments | « runtime/observatory/lib/src/repositories/sample_profile.dart ('k') | runtime/observatory/observatory_sources.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698