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

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

Issue 542363003: Don't double-escape in strings in the VM Service, and don't use \u0000 to determine the string lengt (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: build Created 6 years, 3 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
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 static int LexicalSortName(ServiceObject o1, ServiceObject o2) { 10 static int LexicalSortName(ServiceObject o1, ServiceObject o2) {
(...skipping 1208 matching lines...) Expand 10 before | Expand all | Expand 10 after
1219 String toString() => "ServiceMap($_map)"; 1219 String toString() => "ServiceMap($_map)";
1220 } 1220 }
1221 1221
1222 /// A [DartError] is peered to a Dart Error object. 1222 /// A [DartError] is peered to a Dart Error object.
1223 class DartError extends ServiceObject { 1223 class DartError extends ServiceObject {
1224 DartError._empty(ServiceObject owner) : super._empty(owner); 1224 DartError._empty(ServiceObject owner) : super._empty(owner);
1225 1225
1226 @observable String kind; 1226 @observable String kind;
1227 @observable String message; 1227 @observable String message;
1228 @observable Instance exception; 1228 @observable Instance exception;
1229 @observable ServiceMap stacktrace; 1229 @observable Instance stacktrace;
1230 1230
1231 void _update(ObservableMap map, bool mapIsRef) { 1231 void _update(ObservableMap map, bool mapIsRef) {
1232 kind = map['kind']; 1232 kind = map['kind'];
1233 message = map['message']; 1233 message = map['message'];
1234 exception = new ServiceObject._fromMap(owner, map['exception']); 1234 exception = new ServiceObject._fromMap(owner, map['exception']);
1235 stacktrace = new ServiceObject._fromMap(owner, map['stacktrace']); 1235 stacktrace = new ServiceObject._fromMap(owner, map['stacktrace']);
1236 name = 'DartError $kind'; 1236 name = 'DartError $kind';
1237 vmName = name; 1237 vmName = name;
1238 } 1238 }
1239 1239
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
1502 return isolate.get(id + "/$command"); 1502 return isolate.get(id + "/$command");
1503 } 1503 }
1504 1504
1505 String toString() => 'Class($vmName)'; 1505 String toString() => 'Class($vmName)';
1506 } 1506 }
1507 1507
1508 class Instance extends ServiceObject { 1508 class Instance extends ServiceObject {
1509 @observable Class clazz; 1509 @observable Class clazz;
1510 @observable int size; 1510 @observable int size;
1511 @observable String valueAsString; // If primitive. 1511 @observable String valueAsString; // If primitive.
1512 @observable bool valueAsStringIsTruncated;
1512 @observable ServiceFunction closureFunc; // If a closure. 1513 @observable ServiceFunction closureFunc; // If a closure.
1513 @observable Context closureCtxt; // If a closure. 1514 @observable Context closureCtxt; // If a closure.
1514 @observable String name; // If a Type. 1515 @observable String name; // If a Type.
1515 @observable int length; // If a List. 1516 @observable int length; // If a List.
1516 1517
1517 @observable var typeClass; 1518 @observable var typeClass;
1518 @observable var fields; 1519 @observable var fields;
1519 @observable var nativeFields; 1520 @observable var nativeFields;
1520 @observable var elements; 1521 @observable var elements;
1521 @observable var userName; 1522 @observable var userName;
1522 @observable var referent; // If a MirrorReference. 1523 @observable var referent; // If a MirrorReference.
1523 @observable Instance key; // If a WeakProperty. 1524 @observable Instance key; // If a WeakProperty.
1524 @observable Instance value; // If a WeakProperty. 1525 @observable Instance value; // If a WeakProperty.
1525 1526
1526 bool get isClosure => closureFunc != null; 1527 bool get isClosure => closureFunc != null;
1527 1528
1528 Instance._empty(ServiceObjectOwner owner) : super._empty(owner); 1529 Instance._empty(ServiceObjectOwner owner) : super._empty(owner);
1529 1530
1530 void _update(ObservableMap map, bool mapIsRef) { 1531 void _update(ObservableMap map, bool mapIsRef) {
1531 // Extract full properties. 1532 // Extract full properties.
1532 _upgradeCollection(map, isolate); 1533 _upgradeCollection(map, isolate);
1533 1534
1534 clazz = map['class']; 1535 clazz = map['class'];
1535 size = map['size']; 1536 size = map['size'];
1536 valueAsString = map['valueAsString']; 1537 valueAsString = map['valueAsString'];
1538 // Coerce absence to false.
1539 valueAsStringIsTruncated = map['valueAsStringIsTruncated'] == true;
1537 closureFunc = map['closureFunc']; 1540 closureFunc = map['closureFunc'];
1538 closureCtxt = map['closureCtxt']; 1541 closureCtxt = map['closureCtxt'];
1539 name = map['name']; 1542 name = map['name'];
1540 length = map['length']; 1543 length = map['length'];
1541 1544
1542 if (mapIsRef) { 1545 if (mapIsRef) {
1543 return; 1546 return;
1544 } 1547 }
1545 1548
1546 nativeFields = map['nativeFields']; 1549 nativeFields = map['nativeFields'];
(...skipping 1011 matching lines...) Expand 10 before | Expand all | Expand 10 after
2558 var v = list[i]; 2561 var v = list[i];
2559 if ((v is ObservableMap) && _isServiceMap(v)) { 2562 if ((v is ObservableMap) && _isServiceMap(v)) {
2560 list[i] = owner.getFromMap(v); 2563 list[i] = owner.getFromMap(v);
2561 } else if (v is ObservableList) { 2564 } else if (v is ObservableList) {
2562 _upgradeObservableList(v, owner); 2565 _upgradeObservableList(v, owner);
2563 } else if (v is ObservableMap) { 2566 } else if (v is ObservableMap) {
2564 _upgradeObservableMap(v, owner); 2567 _upgradeObservableMap(v, owner);
2565 } 2568 }
2566 } 2569 }
2567 } 2570 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698