OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 library script_inset_element; | 5 library script_inset_element; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:html'; | 8 import 'dart:html'; |
9 import 'observatory_element.dart'; | 9 import 'observatory_element.dart'; |
10 import 'service_ref.dart'; | 10 import 'service_ref.dart'; |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 r.append(cell(entry.count.toString())); | 152 r.append(cell(entry.count.toString())); |
153 r.append(cell(serviceRef(entry.target))); | 153 r.append(cell(serviceRef(entry.target))); |
154 details.append(r); | 154 details.append(r); |
155 } | 155 } |
156 } | 156 } |
157 return details; | 157 return details; |
158 }); | 158 }); |
159 } | 159 } |
160 } | 160 } |
161 | 161 |
162 class DeclarationAnnotation extends Annotation { | 162 abstract class DeclarationAnnotation extends Annotation { |
163 DeclarationAnnotation(decl) { | 163 DeclarationAnnotation(decl) { |
164 assert(decl.loaded); | 164 assert(decl.loaded); |
165 var script = decl.script; | 165 var script = decl.script; |
166 line = script.tokenToLine(decl.tokenPos); | 166 line = script.tokenToLine(decl.tokenPos); |
167 columnStart = script.tokenToCol(decl.tokenPos); | 167 columnStart = script.tokenToCol(decl.tokenPos); |
168 if ((line == null) || (columnStart == null)) { | 168 if ((line == null) || (columnStart == null)) { |
169 line = 0; | 169 line = 0; |
170 columnStart = 0; | 170 columnStart = 0; |
171 columnStop = 0; | 171 columnStop = 0; |
172 } else { | 172 } else { |
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
621 e.classes.add("emptyBreakpoint"); | 621 e.classes.add("emptyBreakpoint"); |
622 e.classes.add('noCopy'); | 622 e.classes.add('noCopy'); |
623 e.text = nbsp; | 623 e.text = nbsp; |
624 return e; | 624 return e; |
625 } | 625 } |
626 e.text = 'B'; | 626 e.text = 'B'; |
627 update() { | 627 update() { |
628 e.classes.clear(); | 628 e.classes.clear(); |
629 e.classes.add('noCopy'); | 629 e.classes.add('noCopy'); |
630 | 630 |
631 if (busy) { | 631 if (!line.possibleBpt) { |
| 632 e.classes.add("emptyBreakpoint"); |
| 633 e.text = nbsp; |
| 634 } else if (busy) { |
632 e.classes.add("busyBreakpoint"); | 635 e.classes.add("busyBreakpoint"); |
633 } else { | 636 } else { |
634 if (line.breakpoints != null) { | 637 if (line.breakpoints != null) { |
635 if (line.breakpointResolved) { | 638 if (line.breakpointResolved) { |
636 e.classes.add("resolvedBreakpoint"); | 639 e.classes.add("resolvedBreakpoint"); |
637 } else { | 640 } else { |
638 e.classes.add("unresolvedBreakpoint"); | 641 e.classes.add("unresolvedBreakpoint"); |
639 } | 642 } |
640 } else { | 643 } else { |
641 e.classes.add("possibleBreakpoint"); | 644 e.classes.add("possibleBreakpoint"); |
642 } | 645 } |
643 } | 646 } |
644 } | 647 } |
645 line.changes.listen((_) => update()); | 648 line.changes.listen((_) => update()); |
646 e.onClick.listen((event) { | 649 e.onClick.listen((event) { |
647 if (busy) { | 650 if (busy) { |
648 return; | 651 return; |
649 } | 652 } |
650 busy = true; | 653 busy = true; |
651 if (line.breakpoints == null) { | 654 if (line.breakpoints == null) { |
652 // No breakpoint. Add it. | 655 // No breakpoint. Add it. |
653 line.script.isolate.addBreakpoint(line.script, line.line).then((_) { | 656 line.script.isolate.addBreakpoint(line.script, line.line) |
654 busy = false; | 657 .catchError((e, st) { |
655 update(); | 658 if (e is! ServerRpcException || |
656 }); | 659 (e as ServerRpcException).code != |
| 660 ServerRpcException.kNoBreakAtLine) { |
| 661 app.handleException(e, st); |
| 662 }}) |
| 663 .whenComplete(() { |
| 664 busy = false; |
| 665 update(); |
| 666 }); |
657 } else { | 667 } else { |
658 // Existing breakpoint. Remove it. | 668 // Existing breakpoint. Remove it. |
659 List pending = []; | 669 List pending = []; |
660 for (var bpt in line.breakpoints) { | 670 for (var bpt in line.breakpoints) { |
661 pending.add(line.script.isolate.removeBreakpoint(bpt)); | 671 pending.add(line.script.isolate.removeBreakpoint(bpt)); |
662 } | 672 } |
663 Future.wait(pending).then((_) { | 673 Future.wait(pending).then((_) { |
664 busy = false; | 674 busy = false; |
665 update(); | 675 update(); |
666 }); | 676 }); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
728 e.append(span('\n')); | 738 e.append(span('\n')); |
729 | 739 |
730 return e; | 740 return e; |
731 } | 741 } |
732 | 742 |
733 ScriptInsetElement.created() | 743 ScriptInsetElement.created() |
734 : super.created() { | 744 : super.created() { |
735 _updateTask = new Task(update); | 745 _updateTask = new Task(update); |
736 } | 746 } |
737 } | 747 } |
OLD | NEW |