OLD | NEW |
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 909 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
920 var reload = isolate.reload().catchError((e) { | 920 var reload = isolate.reload().catchError((e) { |
921 Logger.root.info('Bulk reloading of isolates failed: $e'); | 921 Logger.root.info('Bulk reloading of isolates failed: $e'); |
922 }); | 922 }); |
923 reloads.add(reload); | 923 reloads.add(reload); |
924 } | 924 } |
925 return Future.wait(reloads); | 925 return Future.wait(reloads); |
926 } | 926 } |
927 } | 927 } |
928 | 928 |
929 class FakeVM extends VM { | 929 class FakeVM extends VM { |
| 930 String get displayName => name; |
| 931 |
930 final Map _responses = {}; | 932 final Map _responses = {}; |
931 FakeVM(Map responses) { | 933 FakeVM(Map responses) { |
932 if (responses == null) { | 934 if (responses == null) { |
933 return; | 935 return; |
934 } | 936 } |
935 responses.forEach((uri, response) { | 937 responses.forEach((uri, response) { |
936 // Encode as string. | 938 // Encode as string. |
937 _responses[_canonicalizeUri(Uri.parse(uri))] = response; | 939 _responses[_canonicalizeUri(Uri.parse(uri))] = response; |
938 }); | 940 }); |
939 } | 941 } |
(...skipping 904 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1844 notifyPropertyChange(Symbol field, Object oldValue, Object newValue) => | 1846 notifyPropertyChange(Symbol field, Object oldValue, Object newValue) => |
1845 _map.notifyPropertyChange(field, oldValue, newValue); | 1847 _map.notifyPropertyChange(field, oldValue, newValue); |
1846 void observed() => _map.observed(); | 1848 void observed() => _map.observed(); |
1847 void unobserved() => _map.unobserved(); | 1849 void unobserved() => _map.unobserved(); |
1848 Stream<List<ChangeRecord>> get changes => _map.changes; | 1850 Stream<List<ChangeRecord>> get changes => _map.changes; |
1849 bool get hasObservers => _map.hasObservers; | 1851 bool get hasObservers => _map.hasObservers; |
1850 | 1852 |
1851 String toString() => "ServiceMap($_map)"; | 1853 String toString() => "ServiceMap($_map)"; |
1852 } | 1854 } |
1853 | 1855 |
| 1856 M.ErrorKind stringToErrorKind(String value) { |
| 1857 switch(value) { |
| 1858 case 'UnhandledException': return M.ErrorKind.UnhandledException; |
| 1859 case 'LanguageError': return M.ErrorKind.UnhandledException; |
| 1860 case 'InternalError': return M.ErrorKind.InternalError; |
| 1861 case 'TerminationError': return M.ErrorKind.TerminationError; |
| 1862 } |
| 1863 Logger.root.severe('Unrecognized error kind: $value'); |
| 1864 throw new FallThroughError(); |
| 1865 } |
| 1866 |
1854 /// A [DartError] is peered to a Dart Error object. | 1867 /// A [DartError] is peered to a Dart Error object. |
1855 class DartError extends ServiceObject { | 1868 class DartError extends ServiceObject implements M.Error { |
1856 DartError._empty(ServiceObject owner) : super._empty(owner); | 1869 DartError._empty(ServiceObject owner) : super._empty(owner); |
1857 | 1870 |
| 1871 M.ErrorKind kind; |
1858 @observable String message; | 1872 @observable String message; |
1859 @observable Instance exception; | 1873 @observable Instance exception; |
1860 @observable Instance stacktrace; | 1874 @observable Instance stacktrace; |
1861 | 1875 |
1862 void _update(ObservableMap map, bool mapIsRef) { | 1876 void _update(ObservableMap map, bool mapIsRef) { |
1863 message = map['message']; | 1877 message = map['message']; |
| 1878 kind = stringToErrorKind(map['kind']); |
1864 exception = new ServiceObject._fromMap(owner, map['exception']); | 1879 exception = new ServiceObject._fromMap(owner, map['exception']); |
1865 stacktrace = new ServiceObject._fromMap(owner, map['stacktrace']); | 1880 stacktrace = new ServiceObject._fromMap(owner, map['stacktrace']); |
1866 name = 'DartError($message)'; | 1881 name = 'DartError($message)'; |
1867 vmName = name; | 1882 vmName = name; |
1868 } | 1883 } |
1869 | 1884 |
1870 String toString() => 'DartError($message)'; | 1885 String toString() => 'DartError($message)'; |
1871 } | 1886 } |
1872 | 1887 |
1873 Level _findLogLevel(int value) { | 1888 Level _findLogLevel(int value) { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1909 static const kExtension = 'Extension'; | 1924 static const kExtension = 'Extension'; |
1910 | 1925 |
1911 ServiceEvent._empty(ServiceObjectOwner owner) : super._empty(owner); | 1926 ServiceEvent._empty(ServiceObjectOwner owner) : super._empty(owner); |
1912 | 1927 |
1913 ServiceEvent.connectionClosed(this.reason) : super._empty(null) { | 1928 ServiceEvent.connectionClosed(this.reason) : super._empty(null) { |
1914 kind = kConnectionClosed; | 1929 kind = kConnectionClosed; |
1915 } | 1930 } |
1916 | 1931 |
1917 @observable String kind; | 1932 @observable String kind; |
1918 @observable DateTime timestamp; | 1933 @observable DateTime timestamp; |
| 1934 List<M.Breakpoint> pauseBreakpoints; |
1919 @observable Breakpoint breakpoint; | 1935 @observable Breakpoint breakpoint; |
1920 @observable Frame topFrame; | 1936 @observable Frame topFrame; |
| 1937 @observable DartError error; |
1921 @observable String extensionRPC; | 1938 @observable String extensionRPC; |
1922 @observable Instance exception; | 1939 @observable Instance exception; |
1923 @observable Instance reloadError; | 1940 @observable Instance reloadError; |
1924 @observable bool atAsyncSuspension; | 1941 @observable bool atAsyncSuspension; |
1925 @observable ServiceObject inspectee; | 1942 @observable Instance inspectee; |
1926 @observable ByteData data; | 1943 @observable ByteData data; |
1927 @observable int count; | 1944 @observable int count; |
1928 @observable String reason; | 1945 @observable String reason; |
1929 @observable String exceptions; | 1946 @observable String exceptions; |
1930 @observable String bytesAsString; | 1947 @observable String bytesAsString; |
1931 @observable Map logRecord; | 1948 @observable Map logRecord; |
1932 @observable String extensionKind; | 1949 @observable String extensionKind; |
1933 @observable Map extensionData; | 1950 @observable Map extensionData; |
1934 @observable List timelineEvents; | 1951 @observable List timelineEvents; |
1935 @observable String spawnToken; | 1952 @observable String spawnToken; |
(...skipping 17 matching lines...) Expand all Loading... |
1953 assert(map['isolate'] == null || owner == map['isolate']); | 1970 assert(map['isolate'] == null || owner == map['isolate']); |
1954 timestamp = | 1971 timestamp = |
1955 new DateTime.fromMillisecondsSinceEpoch(map['timestamp']); | 1972 new DateTime.fromMillisecondsSinceEpoch(map['timestamp']); |
1956 kind = map['kind']; | 1973 kind = map['kind']; |
1957 notifyPropertyChange(#isPauseEvent, 0, 1); | 1974 notifyPropertyChange(#isPauseEvent, 0, 1); |
1958 name = 'ServiceEvent $kind'; | 1975 name = 'ServiceEvent $kind'; |
1959 vmName = name; | 1976 vmName = name; |
1960 if (map['breakpoint'] != null) { | 1977 if (map['breakpoint'] != null) { |
1961 breakpoint = map['breakpoint']; | 1978 breakpoint = map['breakpoint']; |
1962 } | 1979 } |
1963 // TODO(turnidge): Expose the full list of breakpoints. For now | |
1964 // we just pretend like there is only one active breakpoint. | |
1965 if (map['pauseBreakpoints'] != null) { | 1980 if (map['pauseBreakpoints'] != null) { |
1966 var pauseBpts = map['pauseBreakpoints']; | 1981 pauseBreakpoints = map['pauseBreakpoints']; |
1967 if (pauseBpts.length > 0) { | 1982 if (pauseBreakpoints.length > 0) { |
1968 breakpoint = pauseBpts[0]; | 1983 breakpoint = pauseBreakpoints[0]; |
1969 } | 1984 } |
| 1985 } else { |
| 1986 pauseBreakpoints = const []; |
| 1987 } |
| 1988 if (map['error'] != null) { |
| 1989 error = map['error']; |
1970 } | 1990 } |
1971 if (map['extensionRPC'] != null) { | 1991 if (map['extensionRPC'] != null) { |
1972 extensionRPC = map['extensionRPC']; | 1992 extensionRPC = map['extensionRPC']; |
1973 } | 1993 } |
1974 topFrame = map['topFrame']; | 1994 topFrame = map['topFrame']; |
1975 if (map['exception'] != null) { | 1995 if (map['exception'] != null) { |
1976 exception = map['exception']; | 1996 exception = map['exception']; |
1977 } | 1997 } |
1978 atAsyncSuspension = map['atAsyncSuspension'] != null; | 1998 atAsyncSuspension = map['atAsyncSuspension'] != null; |
1979 if (map['inspectee'] != null) { | 1999 if (map['inspectee'] != null) { |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2236 @observable Library library; | 2256 @observable Library library; |
2237 | 2257 |
2238 @observable bool isAbstract; | 2258 @observable bool isAbstract; |
2239 @observable bool isConst; | 2259 @observable bool isConst; |
2240 @observable bool isFinalized; | 2260 @observable bool isFinalized; |
2241 @observable bool isPatch; | 2261 @observable bool isPatch; |
2242 @observable bool isImplemented; | 2262 @observable bool isImplemented; |
2243 | 2263 |
2244 @observable SourceLocation location; | 2264 @observable SourceLocation location; |
2245 | 2265 |
2246 @observable ServiceMap error; | 2266 @observable DartError error; |
2247 @observable int vmCid; | 2267 @observable int vmCid; |
2248 | 2268 |
2249 final Allocations newSpace = new Allocations(); | 2269 final Allocations newSpace = new Allocations(); |
2250 final Allocations oldSpace = new Allocations(); | 2270 final Allocations oldSpace = new Allocations(); |
2251 final AllocationCount promotedByLastNewGC = new AllocationCount(); | 2271 final AllocationCount promotedByLastNewGC = new AllocationCount(); |
2252 | 2272 |
2253 @observable bool get hasNoAllocations => newSpace.empty && oldSpace.empty; | 2273 @observable bool get hasNoAllocations => newSpace.empty && oldSpace.empty; |
2254 @observable bool traceAllocations = false; | 2274 @observable bool traceAllocations = false; |
2255 @reflectable final fields = new ObservableList<Field>(); | 2275 @reflectable final fields = new ObservableList<Field>(); |
2256 @reflectable final functions = new ObservableList<ServiceFunction>(); | 2276 @reflectable final functions = new ObservableList<ServiceFunction>(); |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2363 | 2383 |
2364 Future<ServiceObject> getAllocationSamples([String tags = 'None']) { | 2384 Future<ServiceObject> getAllocationSamples([String tags = 'None']) { |
2365 var params = { 'tags': tags, | 2385 var params = { 'tags': tags, |
2366 'classId': id }; | 2386 'classId': id }; |
2367 return isolate.invokeRpc('_getAllocationSamples', params); | 2387 return isolate.invokeRpc('_getAllocationSamples', params); |
2368 } | 2388 } |
2369 | 2389 |
2370 String toString() => 'Class($vmName)'; | 2390 String toString() => 'Class($vmName)'; |
2371 } | 2391 } |
2372 | 2392 |
2373 class Instance extends HeapObject { | 2393 class Instance extends HeapObject implements M.InstanceRef { |
2374 @observable String kind; | 2394 @observable String kind; |
2375 @observable String valueAsString; // If primitive. | 2395 @observable String valueAsString; // If primitive. |
2376 @observable bool valueAsStringIsTruncated; | 2396 @observable bool valueAsStringIsTruncated; |
2377 @observable ServiceFunction function; // If a closure. | 2397 @observable ServiceFunction function; // If a closure. |
2378 @observable Context context; // If a closure. | 2398 @observable Context context; // If a closure. |
2379 @observable int length; // If a List, Map or TypedData. | 2399 @observable int length; // If a List, Map or TypedData. |
2380 @observable Instance pattern; // If a RegExp. | 2400 @observable Instance pattern; // If a RegExp. |
2381 | 2401 |
2382 @observable String name; | 2402 @observable String name; |
2383 @observable Class typeClass; | 2403 @observable Class typeClass; |
(...skipping 1690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4074 var v = list[i]; | 4094 var v = list[i]; |
4075 if ((v is ObservableMap) && _isServiceMap(v)) { | 4095 if ((v is ObservableMap) && _isServiceMap(v)) { |
4076 list[i] = owner.getFromMap(v); | 4096 list[i] = owner.getFromMap(v); |
4077 } else if (v is ObservableList) { | 4097 } else if (v is ObservableList) { |
4078 _upgradeObservableList(v, owner); | 4098 _upgradeObservableList(v, owner); |
4079 } else if (v is ObservableMap) { | 4099 } else if (v is ObservableMap) { |
4080 _upgradeObservableMap(v, owner); | 4100 _upgradeObservableMap(v, owner); |
4081 } | 4101 } |
4082 } | 4102 } |
4083 } | 4103 } |
OLD | NEW |