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

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

Issue 1157003003: Add TypedData instance kinds. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 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 /// An RpcException represents an exceptional event that happened 7 /// An RpcException represents an exceptional event that happened
8 /// while invoking an rpc. 8 /// while invoking an rpc.
9 abstract class RpcException implements Exception { 9 abstract class RpcException implements Exception {
10 RpcException(this.message); 10 RpcException(this.message);
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 110
111 // Kinds of Instance. 111 // Kinds of Instance.
112 bool get isAbstractType => false; 112 bool get isAbstractType => false;
113 bool get isNull => false; 113 bool get isNull => false;
114 bool get isBool => false; 114 bool get isBool => false;
115 bool get isDouble => false; 115 bool get isDouble => false;
116 bool get isString => false; 116 bool get isString => false;
117 bool get isInt => false; 117 bool get isInt => false;
118 bool get isList => false; 118 bool get isList => false;
119 bool get isMap => false; 119 bool get isMap => false;
120 bool get isTypedData => false;
120 bool get isMirrorReference => false; 121 bool get isMirrorReference => false;
121 bool get isWeakProperty => false; 122 bool get isWeakProperty => false;
122 bool get isClosure => false; 123 bool get isClosure => false;
123 bool get isPlainInstance => false; 124 bool get isPlainInstance => false;
124 125
125 /// Has this object been fully loaded? 126 /// Has this object been fully loaded?
126 bool get loaded => _loaded; 127 bool get loaded => _loaded;
127 bool _loaded = false; 128 bool _loaded = false;
128 // TODO(turnidge): Make loaded observable and get rid of loading 129 // TODO(turnidge): Make loaded observable and get rid of loading
129 // from Isolate. 130 // from Isolate.
(...skipping 1717 matching lines...) Expand 10 before | Expand all | Expand 10 after
1847 class Instance extends ServiceObject { 1848 class Instance extends ServiceObject {
1848 @observable String kind; 1849 @observable String kind;
1849 @observable Class clazz; 1850 @observable Class clazz;
1850 @observable int size; 1851 @observable int size;
1851 @observable int retainedSize; 1852 @observable int retainedSize;
1852 @observable String valueAsString; // If primitive. 1853 @observable String valueAsString; // If primitive.
1853 @observable bool valueAsStringIsTruncated; 1854 @observable bool valueAsStringIsTruncated;
1854 @observable ServiceFunction function; // If a closure. 1855 @observable ServiceFunction function; // If a closure.
1855 @observable Context context; // If a closure. 1856 @observable Context context; // If a closure.
1856 @observable String name; // If a Type. 1857 @observable String name; // If a Type.
1857 @observable int length; // If a List or Map. 1858 @observable int length; // If a List, Map or TypedData.
1858 1859
1859 @observable var typeClass; 1860 @observable var typeClass;
1860 @observable var fields; 1861 @observable var fields;
1861 @observable var nativeFields; 1862 @observable var nativeFields;
1862 @observable var elements; // If a List. 1863 @observable var elements; // If a List.
1863 @observable var associations; // If a Map. 1864 @observable var associations; // If a Map.
1865 @observable var typedElements; // If a TypedData.
1864 @observable var referent; // If a MirrorReference. 1866 @observable var referent; // If a MirrorReference.
1865 @observable Instance key; // If a WeakProperty. 1867 @observable Instance key; // If a WeakProperty.
1866 @observable Instance value; // If a WeakProperty. 1868 @observable Instance value; // If a WeakProperty.
1867 1869
1868 bool get isAbstractType { 1870 bool get isAbstractType {
1869 return (kind == 'Type' || kind == 'TypeRef' || 1871 return (kind == 'Type' || kind == 'TypeRef' ||
1870 kind == 'TypeParameter' || kind == 'BoundedType'); 1872 kind == 'TypeParameter' || kind == 'BoundedType');
1871 } 1873 }
1872 bool get isNull => kind == 'Null'; 1874 bool get isNull => kind == 'Null';
1873 bool get isBool => kind == 'Bool'; 1875 bool get isBool => kind == 'Bool';
1874 bool get isDouble => kind == 'Double'; 1876 bool get isDouble => kind == 'Double';
1875 bool get isString => kind == 'String'; 1877 bool get isString => kind == 'String';
1876 bool get isInt => kind == 'Int'; 1878 bool get isInt => kind == 'Int';
1877 bool get isList => kind == 'List'; 1879 bool get isList => kind == 'List';
1878 bool get isMap => kind == 'Map'; 1880 bool get isMap => kind == 'Map';
1881 bool get isTypedData => kind == 'TypedData';
1879 bool get isMirrorReference => kind == 'MirrorReference'; 1882 bool get isMirrorReference => kind == 'MirrorReference';
1880 bool get isWeakProperty => kind == 'WeakProperty'; 1883 bool get isWeakProperty => kind == 'WeakProperty';
1881 bool get isClosure => kind == 'Closure'; 1884 bool get isClosure => kind == 'Closure';
1882 1885
1883 // TODO(turnidge): Is this properly backwards compatible when new 1886 // TODO(turnidge): Is this properly backwards compatible when new
1884 // instance kinds are added? 1887 // instance kinds are added?
1885 bool get isPlainInstance => kind == 'PlainInstance'; 1888 bool get isPlainInstance => kind == 'PlainInstance';
1886 1889
1887 Instance._empty(ServiceObjectOwner owner) : super._empty(owner); 1890 Instance._empty(ServiceObjectOwner owner) : super._empty(owner);
1888 1891
(...skipping 13 matching lines...) Expand all
1902 length = map['length']; 1905 length = map['length'];
1903 1906
1904 if (mapIsRef) { 1907 if (mapIsRef) {
1905 return; 1908 return;
1906 } 1909 }
1907 1910
1908 nativeFields = map['_nativeFields']; 1911 nativeFields = map['_nativeFields'];
1909 fields = map['fields']; 1912 fields = map['fields'];
1910 elements = map['elements']; 1913 elements = map['elements'];
1911 associations = map['associations']; 1914 associations = map['associations'];
1915 if (map['bytes'] != null) {
1916 var bytes = new Uint8List.fromList(map['bytes']);
1917 switch (map['elementType']) {
1918 case "Uint8ClampedArray":
1919 typedElements = bytes.buffer.asUint8ClampedList(); break;
1920 case "Uint8Array":
1921 typedElements = bytes.buffer.asUint8List(); break;
1922 case "Uint16Array":
1923 typedElements = bytes.buffer.asUint16List(); break;
1924 case "Uint32Array":
1925 typedElements = bytes.buffer.asUint32List(); break;
1926 case "Uint64Array":
1927 typedElements = bytes.buffer.asUint64List(); break;
1928 case "Int8Array":
1929 typedElements = bytes.buffer.asInt8List(); break;
1930 case "Int16Array":
1931 typedElements = bytes.buffer.asInt16List(); break;
1932 case "Int32Array":
1933 typedElements = bytes.buffer.asInt32List(); break;
1934 case "Int64Array":
1935 typedElements = bytes.buffer.asInt64List(); break;
1936 case "Float32Array":
1937 typedElements = bytes.buffer.asFloat32List(); break;
1938 case "Float64Array":
1939 typedElements = bytes.buffer.asFloat64List(); break;
1940 case "Int32x4Array":
1941 typedElements = bytes.buffer.asInt32x4List(); break;
1942 case "Float32x4Array":
1943 typedElements = bytes.buffer.asFloat32x4List(); break;
1944 case "Float64x2Array":
1945 typedElements = bytes.buffer.asFloat64x2List(); break;
1946 default:
1947 typedElements = null;
1948 }
1949 }
1912 typeClass = map['typeClass']; 1950 typeClass = map['typeClass'];
1913 referent = map['mirrorReferent']; 1951 referent = map['mirrorReferent'];
1914 key = map['propertyKey']; 1952 key = map['propertyKey'];
1915 value = map['propertyValue']; 1953 value = map['propertyValue'];
1916 1954
1917 // We are fully loaded. 1955 // We are fully loaded.
1918 _loaded = true; 1956 _loaded = true;
1919 } 1957 }
1920 1958
1921 String get shortName { 1959 String get shortName {
(...skipping 1345 matching lines...) Expand 10 before | Expand all | Expand 10 after
3267 var v = list[i]; 3305 var v = list[i];
3268 if ((v is ObservableMap) && _isServiceMap(v)) { 3306 if ((v is ObservableMap) && _isServiceMap(v)) {
3269 list[i] = owner.getFromMap(v); 3307 list[i] = owner.getFromMap(v);
3270 } else if (v is ObservableList) { 3308 } else if (v is ObservableList) {
3271 _upgradeObservableList(v, owner); 3309 _upgradeObservableList(v, owner);
3272 } else if (v is ObservableMap) { 3310 } else if (v is ObservableMap) {
3273 _upgradeObservableMap(v, owner); 3311 _upgradeObservableMap(v, owner);
3274 } 3312 }
3275 } 3313 }
3276 } 3314 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698