| 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 1379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1390 } | 1390 } |
| 1391 | 1391 |
| 1392 Future stepOver() { | 1392 Future stepOver() { |
| 1393 return invokeRpc('resume', {'step': 'Over'}); | 1393 return invokeRpc('resume', {'step': 'Over'}); |
| 1394 } | 1394 } |
| 1395 | 1395 |
| 1396 Future stepOut() { | 1396 Future stepOut() { |
| 1397 return invokeRpc('resume', {'step': 'Out'}); | 1397 return invokeRpc('resume', {'step': 'Out'}); |
| 1398 } | 1398 } |
| 1399 | 1399 |
| 1400 |
| 1401 static const int kFirstResume = 0; |
| 1402 static const int kSecondResume = 1; |
| 1403 /// result[kFirstResume] completes after the inital resume. The UI should |
| 1404 /// wait on this future because some other breakpoint may be hit before the |
| 1405 /// async continuation. |
| 1406 /// result[kSecondResume] completes after the second resume. Tests should |
| 1407 /// wait on this future to avoid confusing the pause event at the |
| 1408 /// state-machine switch with the pause event after the state-machine switch. |
| 1409 List<Future> asyncStepOver() { |
| 1410 Completer firstResume = new Completer(); |
| 1411 Completer secondResume = new Completer(); |
| 1412 var subscription; |
| 1413 |
| 1414 handleError(error) { |
| 1415 if (subscription != null) { |
| 1416 subscription.cancel(); |
| 1417 subscription = null; |
| 1418 } |
| 1419 firstResume.completeError(error); |
| 1420 secondResume.completeError(error); |
| 1421 } |
| 1422 |
| 1423 if ((pauseEvent == null) || |
| 1424 (pauseEvent.kind != ServiceEvent.kPauseBreakpoint) || |
| 1425 (pauseEvent.asyncContinuation == null)) { |
| 1426 handleError(new Exception("No async continuation available")); |
| 1427 } else { |
| 1428 Instance continuation = pauseEvent.asyncContinuation; |
| 1429 assert(continuation.isClosure); |
| 1430 addBreakOnActivation(continuation).then((Breakpoint continuationBpt) { |
| 1431 vm.getEventStream(VM.kDebugStream).then((stream) { |
| 1432 var onResume = firstResume; |
| 1433 subscription = stream.listen((ServiceEvent event) { |
| 1434 if ((event.kind == ServiceEvent.kPauseBreakpoint) && |
| 1435 (event.breakpoint == continuationBpt)) { |
| 1436 // We are stopped before state-machine dispatch; step-over to |
| 1437 // reach user code. |
| 1438 removeBreakpoint(continuationBpt).then((_) { |
| 1439 onResume = secondResume; |
| 1440 stepOver().catchError(handleError); |
| 1441 }); |
| 1442 } else if (event.kind == ServiceEvent.kResume) { |
| 1443 if (onResume == secondResume) { |
| 1444 subscription.cancel(); |
| 1445 subscription = null; |
| 1446 } |
| 1447 if (onResume != null) { |
| 1448 onResume.complete(this); |
| 1449 onResume = null; |
| 1450 } |
| 1451 } |
| 1452 }); |
| 1453 resume().catchError(handleError); |
| 1454 }).catchError(handleError); |
| 1455 }).catchError(handleError); |
| 1456 } |
| 1457 |
| 1458 return [firstResume.future, secondResume.future]; |
| 1459 } |
| 1460 |
| 1400 Future setName(String newName) { | 1461 Future setName(String newName) { |
| 1401 return invokeRpc('setName', {'name': newName}); | 1462 return invokeRpc('setName', {'name': newName}); |
| 1402 } | 1463 } |
| 1403 | 1464 |
| 1404 Future setExceptionPauseInfo(String exceptions) { | 1465 Future setExceptionPauseInfo(String exceptions) { |
| 1405 return invokeRpc('_setExceptionPauseInfo', {'exceptions': exceptions}); | 1466 return invokeRpc('_setExceptionPauseInfo', {'exceptions': exceptions}); |
| 1406 } | 1467 } |
| 1407 | 1468 |
| 1408 Future<ServiceMap> getStack() { | 1469 Future<ServiceMap> getStack() { |
| 1409 return invokeRpc('getStack', {}); | 1470 return invokeRpc('getStack', {}); |
| (...skipping 2191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3601 var v = list[i]; | 3662 var v = list[i]; |
| 3602 if ((v is ObservableMap) && _isServiceMap(v)) { | 3663 if ((v is ObservableMap) && _isServiceMap(v)) { |
| 3603 list[i] = owner.getFromMap(v); | 3664 list[i] = owner.getFromMap(v); |
| 3604 } else if (v is ObservableList) { | 3665 } else if (v is ObservableList) { |
| 3605 _upgradeObservableList(v, owner); | 3666 _upgradeObservableList(v, owner); |
| 3606 } else if (v is ObservableMap) { | 3667 } else if (v is ObservableMap) { |
| 3607 _upgradeObservableMap(v, owner); | 3668 _upgradeObservableMap(v, owner); |
| 3608 } | 3669 } |
| 3609 } | 3670 } |
| 3610 } | 3671 } |
| OLD | NEW |