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

Side by Side Diff: runtime/bin/vmservice/client/lib/src/service/object.dart

Issue 196173022: Fix PrintToJSONStream for oddball functions (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « runtime/bin/vmservice/client/lib/src/elements/vm_view.dart ('k') | runtime/vm/object.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 /// 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 525 matching lines...) Expand 10 before | Expand all | Expand 10 after
536 node.children.add(child); 536 node.children.add(child);
537 node.summedChildCount += child.count; 537 node.summedChildCount += child.count;
538 } 538 }
539 return node; 539 return node;
540 } 540 }
541 } 541 }
542 542
543 /// A [ServiceObject] which implements [ObservableMap]. 543 /// A [ServiceObject] which implements [ObservableMap].
544 class ServiceMap extends ServiceObject implements ObservableMap { 544 class ServiceMap extends ServiceObject implements ObservableMap {
545 final ObservableMap _map = new ObservableMap(); 545 final ObservableMap _map = new ObservableMap();
546 static String objectIdRingPrefix = 'objects/';
546 547
547 bool get canCache { 548 bool get canCache {
548 return (_serviceType == 'Class' || 549 return (_serviceType == 'Class' ||
549 _serviceType == 'Function' || 550 _serviceType == 'Function' ||
550 _serviceType == 'Library'); 551 _serviceType == 'Library') &&
552 !_id.startsWith(objectIdRingPrefix);
551 } 553 }
552 bool get immutable => canCache; 554 bool get immutable => canCache;
553 555
554 ServiceMap._empty(ServiceObjectOwner owner) : super._empty(owner); 556 ServiceMap._empty(ServiceObjectOwner owner) : super._empty(owner);
555 557
556 String toString() => _map.toString(); 558 String toString() => _map.toString();
557 559
558 void _upgradeValues() { 560 void _upgradeValues() {
559 assert(owner != null); 561 assert(owner != null);
560 _upgradeCollection(_map, owner); 562 _upgradeCollection(_map, owner);
561 } 563 }
562 564
563 void _update(ObservableMap map, bool mapIsRef) { 565 void _update(ObservableMap map, bool mapIsRef) {
564 _loaded = !mapIsRef; 566 _loaded = !mapIsRef;
565 567
566 // TODO(turnidge): Currently _map.clear() prevents us from 568 // TODO(turnidge): Currently _map.clear() prevents us from
567 // upgrading an already upgraded submap. Is clearing really the 569 // upgrading an already upgraded submap. Is clearing really the
568 // right thing to do here? 570 // right thing to do here?
569 _map.clear(); 571 _map.clear();
570 _map.addAll(map); 572 _map.addAll(map);
571 573
572 name = _map['user_name']; 574 name = _map['user_name'];
573 vmName = _map['name']; 575 vmName = _map['name'];
574 _upgradeValues(); 576 _upgradeValues();
575 } 577 }
576 578
577 // Forward Map interface calls. 579 // Forward Map interface calls.
578 void addAll(Map other) => _map.addAll(other); 580 void addAll(Map other) => _map.addAll(other);
579 void clear() => _map.clear(); 581 void clear() => _map.clear();
580 bool containsValue(v) => _map.containsValue(v); 582 bool containsValue(v) => _map.containsValue(v);
581 bool containsKey(k) => _map.containsKey(k); 583 bool containsKey(k) => _map.containsKey(k);
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
991 var v = list[i]; 993 var v = list[i];
992 if ((v is ObservableMap) && _isServiceMap(v)) { 994 if ((v is ObservableMap) && _isServiceMap(v)) {
993 list[i] = owner.getFromMap(v); 995 list[i] = owner.getFromMap(v);
994 } else if (v is ObservableList) { 996 } else if (v is ObservableList) {
995 _upgradeObservableList(v, owner); 997 _upgradeObservableList(v, owner);
996 } else if (v is ObservableMap) { 998 } else if (v is ObservableMap) {
997 _upgradeObservableMap(v, owner); 999 _upgradeObservableMap(v, owner);
998 } 1000 }
999 } 1001 }
1000 } 1002 }
OLDNEW
« no previous file with comments | « runtime/bin/vmservice/client/lib/src/elements/vm_view.dart ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698