Chromium Code Reviews| 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 1378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1389 } | 1389 } |
| 1390 | 1390 |
| 1391 Future stepOver() { | 1391 Future stepOver() { |
| 1392 return invokeRpc('resume', {'step': 'Over'}); | 1392 return invokeRpc('resume', {'step': 'Over'}); |
| 1393 } | 1393 } |
| 1394 | 1394 |
| 1395 Future stepOut() { | 1395 Future stepOut() { |
| 1396 return invokeRpc('resume', {'step': 'Out'}); | 1396 return invokeRpc('resume', {'step': 'Out'}); |
| 1397 } | 1397 } |
| 1398 | 1398 |
| 1399 /// result[0] completes after the inital resume. The UI should wait on this | |
| 1400 /// future because some other breakpoint may be hit before the async | |
| 1401 /// continuation. | |
| 1402 /// result[1] completes after the second resume. Tests should wait on this | |
|
Cutch
2015/07/20 23:49:35
name these constants, e.g.:
result[0] -> result[kF
rmacnak
2015/07/21 17:35:36
Done.
| |
| 1403 /// future to avoid confusing the pause event at the state-machine switch | |
| 1404 /// with the pause event after the state-machine switch. | |
| 1405 List<Future> asyncStepOver() { | |
| 1406 Completer firstResume = new Completer(); | |
| 1407 Completer secondResume = new Completer(); | |
| 1408 var subscription; | |
| 1409 | |
| 1410 handleError(error) { | |
| 1411 if (subscription != null) { | |
| 1412 subscription.cancel(); | |
| 1413 subscription = null; | |
| 1414 } | |
| 1415 firstResume.completeError(error); | |
| 1416 secondResume.completeError(error); | |
| 1417 } | |
| 1418 | |
| 1419 if ((pauseEvent == null) || | |
| 1420 (pauseEvent.kind != ServiceEvent.kPauseBreakpoint) || | |
| 1421 (pauseEvent.asyncContinuation == null)) { | |
| 1422 handleError(new Exception("No async continuation available")); | |
| 1423 } else { | |
| 1424 Instance continuation = pauseEvent.asyncContinuation; | |
| 1425 assert(continuation.isClosure); | |
| 1426 addBreakOnActivation(continuation).then((Breakpoint continuationBpt) { | |
| 1427 isolate.vm.getEventStream(VM.kDebugStream).then((stream) { | |
| 1428 var onResume = firstResume; | |
| 1429 subscription = stream.listen((ServiceEvent event) { | |
| 1430 if ((event.kind == ServiceEvent.kPauseBreakpoint) && | |
| 1431 (event.breakpoint == continuationBpt)) { | |
| 1432 // We are stopped before state-machine dispatch; step-over to | |
| 1433 // reach user code. | |
| 1434 removeBreakpoint(continuationBpt).then((_) { | |
| 1435 onResume = secondResume; | |
| 1436 stepOver().catchError(handleError); | |
| 1437 }); | |
| 1438 } else if (event.kind == ServiceEvent.kResume) { | |
| 1439 if (onResume == secondResume) { | |
| 1440 subscription.cancel(); | |
| 1441 subscription = null; | |
| 1442 } | |
|
Cutch
2015/07/20 23:49:35
else { assert(onResume == firstResume); } ?
rmacnak
2015/07/21 17:35:36
Switching to
if (onResume != null) {
| |
| 1443 onResume.complete(this); | |
| 1444 onResume = null; | |
| 1445 } | |
| 1446 }); | |
| 1447 this.resume().catchError(handleError); | |
|
Cutch
2015/07/20 23:49:35
You use isolate. above, please be consistent with
rmacnak
2015/07/21 17:35:36
Done.
| |
| 1448 }).catchError(handleError); | |
| 1449 }).catchError(handleError); | |
| 1450 } | |
| 1451 | |
| 1452 return [firstResume.future, secondResume.future]; | |
| 1453 } | |
| 1454 | |
| 1399 Future setName(String newName) { | 1455 Future setName(String newName) { |
| 1400 return invokeRpc('setName', {'name': newName}); | 1456 return invokeRpc('setName', {'name': newName}); |
| 1401 } | 1457 } |
| 1402 | 1458 |
| 1403 Future setExceptionPauseInfo(String exceptions) { | 1459 Future setExceptionPauseInfo(String exceptions) { |
| 1404 return invokeRpc('_setExceptionPauseInfo', {'exceptions': exceptions}); | 1460 return invokeRpc('_setExceptionPauseInfo', {'exceptions': exceptions}); |
| 1405 } | 1461 } |
| 1406 | 1462 |
| 1407 Future<ServiceMap> getStack() { | 1463 Future<ServiceMap> getStack() { |
| 1408 return invokeRpc('getStack', {}); | 1464 return invokeRpc('getStack', {}); |
| (...skipping 2174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3583 var v = list[i]; | 3639 var v = list[i]; |
| 3584 if ((v is ObservableMap) && _isServiceMap(v)) { | 3640 if ((v is ObservableMap) && _isServiceMap(v)) { |
| 3585 list[i] = owner.getFromMap(v); | 3641 list[i] = owner.getFromMap(v); |
| 3586 } else if (v is ObservableList) { | 3642 } else if (v is ObservableList) { |
| 3587 _upgradeObservableList(v, owner); | 3643 _upgradeObservableList(v, owner); |
| 3588 } else if (v is ObservableMap) { | 3644 } else if (v is ObservableMap) { |
| 3589 _upgradeObservableMap(v, owner); | 3645 _upgradeObservableMap(v, owner); |
| 3590 } | 3646 } |
| 3591 } | 3647 } |
| 3592 } | 3648 } |
| OLD | NEW |