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

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: Final patch. 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 return new ServiceObject._fromMap(this, map);
779 if (isolate == null) {
780 // Add new isolate to the cache.
781 isolate = new ServiceObject._fromMap(this, map);
782 _isolateCache[id] = isolate;
783 _buildIsolateList();
784
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 } 792 }
794 793
795 // Note that this function does not reload the isolate if it found 794 // Note that this function does not reload the isolate if it found
796 // in the cache. 795 // in the cache.
797 Future<ServiceObject> getIsolate(String isolateId) { 796 Future<ServiceObject> getIsolate(String isolateId) {
798 if (!loaded) { 797 if (!loaded) {
799 // Trigger a VM load, then get the isolate. 798 // Trigger a VM load, then get the isolate.
800 return load().then((_) => getIsolate(isolateId)).catchError(_ignoreError); 799 return load().then((_) => getIsolate(isolateId)).catchError(_ignoreError);
801 } 800 }
802 return new Future.value(_isolateCache[isolateId]); 801 return new Future.value(_isolateCache[isolateId]);
(...skipping 2198 matching lines...) Expand 10 before | Expand all | Expand 10 after
3001 bool isDart; 3000 bool isDart;
3002 ProfileFunction profile; 3001 ProfileFunction profile;
3003 Instance icDataArray; 3002 Instance icDataArray;
3004 Field field; 3003 Field field;
3005 3004
3006 bool get immutable => false; 3005 bool get immutable => false;
3007 3006
3008 ServiceFunction._empty(ServiceObject owner) : super._empty(owner); 3007 ServiceFunction._empty(ServiceObject owner) : super._empty(owner);
3009 3008
3010 void _update(Map map, bool mapIsRef) { 3009 void _update(Map map, bool mapIsRef) {
3011 _upgradeCollection(map, isolate); 3010 _upgradeCollection(map, owner);
3012 super._update(map, mapIsRef); 3011 super._update(map, mapIsRef);
3013 3012
3014 name = map['name']; 3013 name = map['name'];
3015 vmName = (map.containsKey('_vmName') ? map['_vmName'] : name); 3014 vmName = (map.containsKey('_vmName') ? map['_vmName'] : name);
3016 3015
3017 dartOwner = map['owner']; 3016 dartOwner = map['owner'];
3018 kind = stringToFunctionKind(map['_kind']); 3017 kind = stringToFunctionKind(map['_kind']);
3019 isDart = M.isDartFunction(kind); 3018 isDart = M.isDartFunction(kind);
3020 3019
3021 if (dartOwner is ServiceFunction) { 3020 if (dartOwner is ServiceFunction) {
(...skipping 1545 matching lines...) Expand 10 before | Expand all | Expand 10 after
4567 var v = list[i]; 4566 var v = list[i];
4568 if ((v is Map) && _isServiceMap(v)) { 4567 if ((v is Map) && _isServiceMap(v)) {
4569 list[i] = owner.getFromMap(v); 4568 list[i] = owner.getFromMap(v);
4570 } else if (v is List) { 4569 } else if (v is List) {
4571 _upgradeList(v, owner); 4570 _upgradeList(v, owner);
4572 } else if (v is Map) { 4571 } else if (v is Map) {
4573 _upgradeMap(v, owner); 4572 _upgradeMap(v, owner);
4574 } 4573 }
4575 } 4574 }
4576 } 4575 }
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