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 /// Helper function for canceling a Future<StreamSubscription>. | 7 /// Helper function for canceling a Future<StreamSubscription>. |
8 Future cancelFutureSubscription( | 8 Future cancelFutureSubscription( |
9 Future<StreamSubscription> subscriptionFuture) async { | 9 Future<StreamSubscription> subscriptionFuture) async { |
10 if (subscriptionFuture != null) { | 10 if (subscriptionFuture != null) { |
(...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
630 new ObservableMap<String,Isolate>(); | 630 new ObservableMap<String,Isolate>(); |
631 | 631 |
632 // The list of live isolates, ordered by isolate start time. | 632 // The list of live isolates, ordered by isolate start time. |
633 final ObservableList<Isolate> isolates = new ObservableList<Isolate>(); | 633 final ObservableList<Isolate> isolates = new ObservableList<Isolate>(); |
634 | 634 |
635 @observable String version = 'unknown'; | 635 @observable String version = 'unknown'; |
636 @observable String targetCPU; | 636 @observable String targetCPU; |
637 @observable int architectureBits; | 637 @observable int architectureBits; |
638 @observable bool assertsEnabled = false; | 638 @observable bool assertsEnabled = false; |
639 @observable bool typeChecksEnabled = false; | 639 @observable bool typeChecksEnabled = false; |
640 @observable String pid = ''; | 640 @observable int pid = 0; |
641 @observable DateTime startTime; | 641 @observable DateTime startTime; |
642 @observable DateTime refreshTime; | 642 @observable DateTime refreshTime; |
643 @observable Duration get upTime => | 643 @observable Duration get upTime => |
644 (new DateTime.now().difference(startTime)); | 644 (new DateTime.now().difference(startTime)); |
645 | 645 |
646 VM() : super._empty(null) { | 646 VM() : super._empty(null) { |
647 name = 'vm'; | 647 name = 'vm'; |
648 vmName = 'vm'; | 648 vmName = 'vm'; |
649 _cache['vm'] = this; | 649 _cache['vm'] = this; |
650 update(toObservable({'id':'vm', 'type':'@VM'})); | 650 update(toObservable({'id':'vm', 'type':'@VM'})); |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
870 return; | 870 return; |
871 } | 871 } |
872 // Note that upgrading the collection creates any isolates in the | 872 // Note that upgrading the collection creates any isolates in the |
873 // isolate list which are new. | 873 // isolate list which are new. |
874 _upgradeCollection(map, vm); | 874 _upgradeCollection(map, vm); |
875 | 875 |
876 _loaded = true; | 876 _loaded = true; |
877 version = map['version']; | 877 version = map['version']; |
878 targetCPU = map['targetCPU']; | 878 targetCPU = map['targetCPU']; |
879 architectureBits = map['architectureBits']; | 879 architectureBits = map['architectureBits']; |
880 var startTimeMillis = map['startTime'].toInt(); | 880 int startTimeMillis = map['startTime']; |
881 startTime = new DateTime.fromMillisecondsSinceEpoch(startTimeMillis); | 881 startTime = new DateTime.fromMillisecondsSinceEpoch(startTimeMillis); |
882 refreshTime = new DateTime.now(); | 882 refreshTime = new DateTime.now(); |
883 notifyPropertyChange(#upTime, 0, 1); | 883 notifyPropertyChange(#upTime, 0, 1); |
884 pid = map['pid']; | 884 pid = map['pid']; |
885 assertsEnabled = map['_assertsEnabled']; | 885 assertsEnabled = map['_assertsEnabled']; |
886 typeChecksEnabled = map['_typeChecksEnabled']; | 886 typeChecksEnabled = map['_typeChecksEnabled']; |
887 _removeDeadIsolates(map['isolates']); | 887 _removeDeadIsolates(map['isolates']); |
888 } | 888 } |
889 | 889 |
890 // Reload all isolates. | 890 // Reload all isolates. |
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1338 } | 1338 } |
1339 _loaded = true; | 1339 _loaded = true; |
1340 loading = false; | 1340 loading = false; |
1341 | 1341 |
1342 _upgradeCollection(map, isolate); | 1342 _upgradeCollection(map, isolate); |
1343 rootLibrary = map['rootLib']; | 1343 rootLibrary = map['rootLib']; |
1344 if (map['entry'] != null) { | 1344 if (map['entry'] != null) { |
1345 entry = map['entry']; | 1345 entry = map['entry']; |
1346 } | 1346 } |
1347 var savedStartTime = startTime; | 1347 var savedStartTime = startTime; |
1348 var startTimeInMillis = map['startTime'].toInt(); | 1348 int startTimeInMillis = map['startTime']; |
1349 startTime = new DateTime.fromMillisecondsSinceEpoch(startTimeInMillis); | 1349 startTime = new DateTime.fromMillisecondsSinceEpoch(startTimeInMillis); |
1350 notifyPropertyChange(#upTime, 0, 1); | 1350 notifyPropertyChange(#upTime, 0, 1); |
1351 var countersMap = map['_tagCounters']; | 1351 var countersMap = map['_tagCounters']; |
1352 if (countersMap != null) { | 1352 if (countersMap != null) { |
1353 var names = countersMap['names']; | 1353 var names = countersMap['names']; |
1354 var counts = countersMap['counters']; | 1354 var counts = countersMap['counters']; |
1355 assert(names.length == counts.length); | 1355 assert(names.length == counts.length); |
1356 var sum = 0; | 1356 var sum = 0; |
1357 for (var i = 0; i < counts.length; i++) { | 1357 for (var i = 0; i < counts.length; i++) { |
1358 sum += counts[i]; | 1358 sum += counts[i]; |
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1872 kind == kPauseBreakpoint || | 1872 kind == kPauseBreakpoint || |
1873 kind == kPauseInterrupted || | 1873 kind == kPauseInterrupted || |
1874 kind == kPauseException); | 1874 kind == kPauseException); |
1875 } | 1875 } |
1876 | 1876 |
1877 void _update(ObservableMap map, bool mapIsRef) { | 1877 void _update(ObservableMap map, bool mapIsRef) { |
1878 _loaded = true; | 1878 _loaded = true; |
1879 _upgradeCollection(map, owner); | 1879 _upgradeCollection(map, owner); |
1880 assert(map['isolate'] == null || owner == map['isolate']); | 1880 assert(map['isolate'] == null || owner == map['isolate']); |
1881 timestamp = | 1881 timestamp = |
1882 new DateTime.fromMillisecondsSinceEpoch(map['timestamp'].toInt()); | 1882 new DateTime.fromMillisecondsSinceEpoch(map['timestamp']); |
1883 kind = map['kind']; | 1883 kind = map['kind']; |
1884 notifyPropertyChange(#isPauseEvent, 0, 1); | 1884 notifyPropertyChange(#isPauseEvent, 0, 1); |
1885 name = 'ServiceEvent $kind'; | 1885 name = 'ServiceEvent $kind'; |
1886 vmName = name; | 1886 vmName = name; |
1887 if (map['breakpoint'] != null) { | 1887 if (map['breakpoint'] != null) { |
1888 breakpoint = map['breakpoint']; | 1888 breakpoint = map['breakpoint']; |
1889 } | 1889 } |
1890 // TODO(turnidge): Expose the full list of breakpoints. For now | 1890 // TODO(turnidge): Expose the full list of breakpoints. For now |
1891 // we just pretend like there is only one active breakpoint. | 1891 // we just pretend like there is only one active breakpoint. |
1892 if (map['pauseBreakpoints'] != null) { | 1892 if (map['pauseBreakpoints'] != null) { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1927 map['_debuggerSettings']['_exceptions'] != null) { | 1927 map['_debuggerSettings']['_exceptions'] != null) { |
1928 exceptions = map['_debuggerSettings']['_exceptions']; | 1928 exceptions = map['_debuggerSettings']['_exceptions']; |
1929 } | 1929 } |
1930 if (map['bytes'] != null) { | 1930 if (map['bytes'] != null) { |
1931 var bytes = decodeBase64(map['bytes']); | 1931 var bytes = decodeBase64(map['bytes']); |
1932 bytesAsString = UTF8.decode(bytes); | 1932 bytesAsString = UTF8.decode(bytes); |
1933 } | 1933 } |
1934 if (map['logRecord'] != null) { | 1934 if (map['logRecord'] != null) { |
1935 logRecord = map['logRecord']; | 1935 logRecord = map['logRecord']; |
1936 logRecord['time'] = | 1936 logRecord['time'] = |
1937 new DateTime.fromMillisecondsSinceEpoch(logRecord['time'].toInt()); | 1937 new DateTime.fromMillisecondsSinceEpoch(logRecord['time']); |
1938 logRecord['level'] = _findLogLevel(logRecord['level']); | 1938 logRecord['level'] = _findLogLevel(logRecord['level']); |
1939 } | 1939 } |
1940 } | 1940 } |
1941 | 1941 |
1942 String toString() { | 1942 String toString() { |
1943 if (data == null) { | 1943 if (data == null) { |
1944 return "ServiceEvent(owner='${owner.id}', kind='${kind}', " | 1944 return "ServiceEvent(owner='${owner.id}', kind='${kind}', " |
1945 "time=${timestamp})"; | 1945 "time=${timestamp})"; |
1946 } else { | 1946 } else { |
1947 return "ServiceEvent(owner='${owner.id}', kind='${kind}', " | 1947 return "ServiceEvent(owner='${owner.id}', kind='${kind}', " |
(...skipping 1980 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3928 var v = list[i]; | 3928 var v = list[i]; |
3929 if ((v is ObservableMap) && _isServiceMap(v)) { | 3929 if ((v is ObservableMap) && _isServiceMap(v)) { |
3930 list[i] = owner.getFromMap(v); | 3930 list[i] = owner.getFromMap(v); |
3931 } else if (v is ObservableList) { | 3931 } else if (v is ObservableList) { |
3932 _upgradeObservableList(v, owner); | 3932 _upgradeObservableList(v, owner); |
3933 } else if (v is ObservableMap) { | 3933 } else if (v is ObservableMap) { |
3934 _upgradeObservableMap(v, owner); | 3934 _upgradeObservableMap(v, owner); |
3935 } | 3935 } |
3936 } | 3936 } |
3937 } | 3937 } |
OLD | NEW |