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 1265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1276 timers['init'] = (timerMap['time_script_loading'] + | 1276 timers['init'] = (timerMap['time_script_loading'] + |
1277 timerMap['time_creating_snapshot'] + | 1277 timerMap['time_creating_snapshot'] + |
1278 timerMap['time_isolate_initialization'] + | 1278 timerMap['time_isolate_initialization'] + |
1279 timerMap['time_bootstrap']); | 1279 timerMap['time_bootstrap']); |
1280 timers['dart'] = timerMap['time_dart_execution']; | 1280 timers['dart'] = timerMap['time_dart_execution']; |
1281 | 1281 |
1282 updateHeapsFromMap(map['_heaps']); | 1282 updateHeapsFromMap(map['_heaps']); |
1283 _updateBreakpoints(map['breakpoints']); | 1283 _updateBreakpoints(map['breakpoints']); |
1284 exceptionsPauseInfo = map['_debuggerSettings']['_exceptions']; | 1284 exceptionsPauseInfo = map['_debuggerSettings']['_exceptions']; |
1285 | 1285 |
1286 pauseEvent = map['pauseEvent']; | 1286 var newPauseEvent = map['pauseEvent']; |
1287 if (vm.verbose) { | 1287 assert((pauseEvent == null) || |
1288 print('VM-VERBOSE: $name reloaded. pause event= $pauseEvent'); | 1288 (newPauseEvent == null) || |
1289 } | 1289 !newPauseEvent.timestamp.isBefore(pauseEvent.timestamp)); |
| 1290 pauseEvent = newPauseEvent; |
1290 _updateRunState(); | 1291 _updateRunState(); |
1291 error = map['error']; | 1292 error = map['error']; |
1292 | 1293 |
1293 libraries.clear(); | 1294 libraries.clear(); |
1294 libraries.addAll(map['libraries']); | 1295 libraries.addAll(map['libraries']); |
1295 libraries.sort(ServiceObject.LexicalSortName); | 1296 libraries.sort(ServiceObject.LexicalSortName); |
1296 if (savedStartTime == null) { | 1297 if (savedStartTime == null) { |
1297 vm._buildIsolateList(); | 1298 vm._buildIsolateList(); |
1298 } | 1299 } |
1299 } | 1300 } |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1331 void _addBreakpoint(Breakpoint bpt) { | 1332 void _addBreakpoint(Breakpoint bpt) { |
1332 breakpoints[bpt.number] = bpt; | 1333 breakpoints[bpt.number] = bpt; |
1333 } | 1334 } |
1334 | 1335 |
1335 void _removeBreakpoint(Breakpoint bpt) { | 1336 void _removeBreakpoint(Breakpoint bpt) { |
1336 breakpoints.remove(bpt.number); | 1337 breakpoints.remove(bpt.number); |
1337 bpt.remove(); | 1338 bpt.remove(); |
1338 } | 1339 } |
1339 | 1340 |
1340 void _onEvent(ServiceEvent event) { | 1341 void _onEvent(ServiceEvent event) { |
1341 if (vm.verbose) { | |
1342 print('VM-VERBOSE: $name _onEvent $event'); | |
1343 } | |
1344 switch(event.kind) { | 1342 switch(event.kind) { |
1345 case ServiceEvent.kIsolateStart: | 1343 case ServiceEvent.kIsolateStart: |
1346 case ServiceEvent.kIsolateRunnable: | 1344 case ServiceEvent.kIsolateRunnable: |
1347 case ServiceEvent.kIsolateExit: | 1345 case ServiceEvent.kIsolateExit: |
1348 case ServiceEvent.kInspect: | 1346 case ServiceEvent.kInspect: |
1349 // Handled elsewhere. | 1347 // Handled elsewhere. |
1350 break; | 1348 break; |
1351 | 1349 |
1352 case ServiceEvent.kBreakpointAdded: | 1350 case ServiceEvent.kBreakpointAdded: |
1353 _addBreakpoint(event.breakpoint); | 1351 _addBreakpoint(event.breakpoint); |
1354 break; | 1352 break; |
1355 | 1353 |
1356 case ServiceEvent.kIsolateUpdate: | 1354 case ServiceEvent.kIsolateUpdate: |
1357 case ServiceEvent.kBreakpointResolved: | 1355 case ServiceEvent.kBreakpointResolved: |
1358 case ServiceEvent.kDebuggerSettingsUpdate: | 1356 case ServiceEvent.kDebuggerSettingsUpdate: |
1359 // Update occurs as side-effect of caching. | 1357 // Update occurs as side-effect of caching. |
1360 break; | 1358 break; |
1361 | 1359 |
1362 case ServiceEvent.kBreakpointRemoved: | 1360 case ServiceEvent.kBreakpointRemoved: |
1363 _removeBreakpoint(event.breakpoint); | 1361 _removeBreakpoint(event.breakpoint); |
1364 break; | 1362 break; |
1365 | 1363 |
1366 case ServiceEvent.kPauseStart: | 1364 case ServiceEvent.kPauseStart: |
1367 case ServiceEvent.kPauseExit: | 1365 case ServiceEvent.kPauseExit: |
1368 case ServiceEvent.kPauseBreakpoint: | 1366 case ServiceEvent.kPauseBreakpoint: |
1369 case ServiceEvent.kPauseInterrupted: | 1367 case ServiceEvent.kPauseInterrupted: |
1370 case ServiceEvent.kPauseException: | 1368 case ServiceEvent.kPauseException: |
1371 case ServiceEvent.kResume: | 1369 case ServiceEvent.kResume: |
| 1370 assert((pauseEvent == null) || |
| 1371 !event.timestamp.isBefore(pauseEvent.timestamp)); |
1372 pauseEvent = event; | 1372 pauseEvent = event; |
1373 print('VM-VERBOSE: $name pause event $pauseEvent'); | |
1374 _updateRunState(); | 1373 _updateRunState(); |
1375 break; | 1374 break; |
1376 | 1375 |
1377 case ServiceEvent.kGraph: | 1376 case ServiceEvent.kGraph: |
1378 _loadHeapSnapshot(event); | 1377 _loadHeapSnapshot(event); |
1379 break; | 1378 break; |
1380 | 1379 |
1381 case ServiceEvent.kGC: | 1380 case ServiceEvent.kGC: |
1382 // Ignore GC events for now. | 1381 // Ignore GC events for now. |
1383 break; | 1382 break; |
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1827 if (map['logRecord'] != null) { | 1826 if (map['logRecord'] != null) { |
1828 logRecord = map['logRecord']; | 1827 logRecord = map['logRecord']; |
1829 logRecord['time'] = | 1828 logRecord['time'] = |
1830 new DateTime.fromMillisecondsSinceEpoch(logRecord['time'].toInt()); | 1829 new DateTime.fromMillisecondsSinceEpoch(logRecord['time'].toInt()); |
1831 logRecord['level'] = _findLogLevel(logRecord['level']); | 1830 logRecord['level'] = _findLogLevel(logRecord['level']); |
1832 } | 1831 } |
1833 } | 1832 } |
1834 | 1833 |
1835 String toString() { | 1834 String toString() { |
1836 if (data == null) { | 1835 if (data == null) { |
1837 return "ServiceEvent(owner='${owner.id}', kind='${kind}')"; | 1836 return "ServiceEvent(owner='${owner.id}', kind='${kind}', " |
| 1837 "time=${timestamp})"; |
1838 } else { | 1838 } else { |
1839 return "ServiceEvent(owner='${owner.id}', kind='${kind}', " | 1839 return "ServiceEvent(owner='${owner.id}', kind='${kind}', " |
1840 "data.lengthInBytes=${data.lengthInBytes})"; | 1840 "data.lengthInBytes=${data.lengthInBytes}, time=${timestamp})"; |
1841 } | 1841 } |
1842 } | 1842 } |
1843 } | 1843 } |
1844 | 1844 |
1845 class Breakpoint extends ServiceObject { | 1845 class Breakpoint extends ServiceObject { |
1846 Breakpoint._empty(ServiceObjectOwner owner) : super._empty(owner); | 1846 Breakpoint._empty(ServiceObjectOwner owner) : super._empty(owner); |
1847 | 1847 |
1848 // TODO(turnidge): Add state to track if a breakpoint has been | 1848 // TODO(turnidge): Add state to track if a breakpoint has been |
1849 // removed from the program. Remove from the cache when deleted. | 1849 // removed from the program. Remove from the cache when deleted. |
1850 bool get canCache => true; | 1850 bool get canCache => true; |
(...skipping 1959 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3810 var v = list[i]; | 3810 var v = list[i]; |
3811 if ((v is ObservableMap) && _isServiceMap(v)) { | 3811 if ((v is ObservableMap) && _isServiceMap(v)) { |
3812 list[i] = owner.getFromMap(v); | 3812 list[i] = owner.getFromMap(v); |
3813 } else if (v is ObservableList) { | 3813 } else if (v is ObservableList) { |
3814 _upgradeObservableList(v, owner); | 3814 _upgradeObservableList(v, owner); |
3815 } else if (v is ObservableMap) { | 3815 } else if (v is ObservableMap) { |
3816 _upgradeObservableMap(v, owner); | 3816 _upgradeObservableMap(v, owner); |
3817 } | 3817 } |
3818 } | 3818 } |
3819 } | 3819 } |
OLD | NEW |