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

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 {
1882 return kind == 'Uint8ClampedList'
1883 || kind == 'Uint8List'
1884 || kind == 'Uint16List'
1885 || kind == 'Uint32List'
1886 || kind == 'Uint64List'
1887 || kind == 'Int8List'
1888 || kind == 'Int16List'
1889 || kind == 'Int32List'
1890 || kind == 'Int64List'
1891 || kind == 'Float32List'
1892 || kind == 'Float64List'
1893 || kind == 'Int32x4List'
1894 || kind == 'Float32x4List'
1895 || kind == 'Float64x2List';
1896 }
1879 bool get isMirrorReference => kind == 'MirrorReference'; 1897 bool get isMirrorReference => kind == 'MirrorReference';
1880 bool get isWeakProperty => kind == 'WeakProperty'; 1898 bool get isWeakProperty => kind == 'WeakProperty';
1881 bool get isClosure => kind == 'Closure'; 1899 bool get isClosure => kind == 'Closure';
1882 1900
1883 // TODO(turnidge): Is this properly backwards compatible when new 1901 // TODO(turnidge): Is this properly backwards compatible when new
1884 // instance kinds are added? 1902 // instance kinds are added?
1885 bool get isPlainInstance => kind == 'PlainInstance'; 1903 bool get isPlainInstance => kind == 'PlainInstance';
1886 1904
1887 Instance._empty(ServiceObjectOwner owner) : super._empty(owner); 1905 Instance._empty(ServiceObjectOwner owner) : super._empty(owner);
1888 1906
(...skipping 13 matching lines...) Expand all
1902 length = map['length']; 1920 length = map['length'];
1903 1921
1904 if (mapIsRef) { 1922 if (mapIsRef) {
1905 return; 1923 return;
1906 } 1924 }
1907 1925
1908 nativeFields = map['_nativeFields']; 1926 nativeFields = map['_nativeFields'];
1909 fields = map['fields']; 1927 fields = map['fields'];
1910 elements = map['elements']; 1928 elements = map['elements'];
1911 associations = map['associations']; 1929 associations = map['associations'];
1930 if (map['bytes'] != null) {
1931 var bytes = decodeBase64(map['bytes']);
1932 switch (map['kind']) {
1933 case "Uint8ClampedList":
1934 typedElements = bytes.buffer.asUint8ClampedList(); break;
1935 case "Uint8List":
1936 typedElements = bytes.buffer.asUint8List(); break;
1937 case "Uint16List":
1938 typedElements = bytes.buffer.asUint16List(); break;
1939 case "Uint32List":
1940 typedElements = bytes.buffer.asUint32List(); break;
1941 case "Uint64List":
1942 typedElements = bytes.buffer.asUint64List(); break;
1943 case "Int8List":
1944 typedElements = bytes.buffer.asInt8List(); break;
1945 case "Int16List":
1946 typedElements = bytes.buffer.asInt16List(); break;
1947 case "Int32List":
1948 typedElements = bytes.buffer.asInt32List(); break;
1949 case "Int64List":
1950 typedElements = bytes.buffer.asInt64List(); break;
1951 case "Float32List":
1952 typedElements = bytes.buffer.asFloat32List(); break;
1953 case "Float64List":
1954 typedElements = bytes.buffer.asFloat64List(); break;
1955 case "Int32x4List":
1956 typedElements = bytes.buffer.asInt32x4List(); break;
1957 case "Float32x4List":
1958 typedElements = bytes.buffer.asFloat32x4List(); break;
1959 case "Float64x2List":
1960 typedElements = bytes.buffer.asFloat64x2List(); break;
1961 }
1962 }
1912 typeClass = map['typeClass']; 1963 typeClass = map['typeClass'];
1913 referent = map['mirrorReferent']; 1964 referent = map['mirrorReferent'];
1914 key = map['propertyKey']; 1965 key = map['propertyKey'];
1915 value = map['propertyValue']; 1966 value = map['propertyValue'];
1916 1967
1917 // We are fully loaded. 1968 // We are fully loaded.
1918 _loaded = true; 1969 _loaded = true;
1919 } 1970 }
1920 1971
1921 String get shortName { 1972 String get shortName {
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
2094 @observable Library library; 2145 @observable Library library;
2095 @observable Instance declaredType; 2146 @observable Instance declaredType;
2096 @observable bool isStatic; 2147 @observable bool isStatic;
2097 @observable bool isFinal; 2148 @observable bool isFinal;
2098 @observable bool isConst; 2149 @observable bool isConst;
2099 @observable Instance staticValue; 2150 @observable Instance staticValue;
2100 @observable String name; 2151 @observable String name;
2101 @observable String vmName; 2152 @observable String vmName;
2102 2153
2103 @observable bool guardNullable; 2154 @observable bool guardNullable;
2104 @observable String guardClass; 2155 @observable var /* Class | String */ guardClass;
2105 @observable String guardLength; 2156 @observable String guardLength;
2106 @observable SourceLocation location; 2157 @observable SourceLocation location;
2107 2158
2108 Field._empty(ServiceObjectOwner owner) : super._empty(owner); 2159 Field._empty(ServiceObjectOwner owner) : super._empty(owner);
2109 2160
2110 void _update(ObservableMap map, bool mapIsRef) { 2161 void _update(ObservableMap map, bool mapIsRef) {
2111 // Extract full properties. 2162 // Extract full properties.
2112 _upgradeCollection(map, isolate); 2163 _upgradeCollection(map, isolate);
2113 2164
2114 name = map['name']; 2165 name = map['name'];
(...skipping 1153 matching lines...) Expand 10 before | Expand all | Expand 10 after
3268 var v = list[i]; 3319 var v = list[i];
3269 if ((v is ObservableMap) && _isServiceMap(v)) { 3320 if ((v is ObservableMap) && _isServiceMap(v)) {
3270 list[i] = owner.getFromMap(v); 3321 list[i] = owner.getFromMap(v);
3271 } else if (v is ObservableList) { 3322 } else if (v is ObservableList) {
3272 _upgradeObservableList(v, owner); 3323 _upgradeObservableList(v, owner);
3273 } else if (v is ObservableMap) { 3324 } else if (v is ObservableMap) {
3274 _upgradeObservableMap(v, owner); 3325 _upgradeObservableMap(v, owner);
3275 } 3326 }
3276 } 3327 }
3277 } 3328 }
OLDNEW
« no previous file with comments | « runtime/observatory/lib/src/elements/instance_view.html ('k') | runtime/observatory/tests/service/typed_data_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698