| 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 'package:observatory/service.dart'; | 10 import 'package:observatory/service.dart'; |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 @CustomTag('breakpoint-toggle') | 277 @CustomTag('breakpoint-toggle') |
| 278 class BreakpointToggleElement extends ObservatoryElement { | 278 class BreakpointToggleElement extends ObservatoryElement { |
| 279 @published ScriptLine line; | 279 @published ScriptLine line; |
| 280 @observable bool busy = false; | 280 @observable bool busy = false; |
| 281 | 281 |
| 282 void toggleBreakpoint(var a, var b, var c) { | 282 void toggleBreakpoint(var a, var b, var c) { |
| 283 if (busy) { | 283 if (busy) { |
| 284 return; | 284 return; |
| 285 } | 285 } |
| 286 busy = true; | 286 busy = true; |
| 287 if (line.bpt == null) { | 287 if (line.breakpoints == null) { |
| 288 // No breakpoint. Add it. | 288 // No breakpoint. Add it. |
| 289 line.script.isolate.addBreakpoint(line.script, line.line).then((_) { | 289 line.script.isolate.addBreakpoint(line.script, line.line).then((_) { |
| 290 busy = false; | 290 busy = false; |
| 291 }); | 291 }); |
| 292 } else { | 292 } else { |
| 293 // Existing breakpoint. Remove it. | 293 // Existing breakpoint. Remove it. |
| 294 line.script.isolate.removeBreakpoint(line.bpt).then((_) { | 294 List pending = []; |
| 295 busy = false; | 295 for (var bpt in line.breakpoints) { |
| 296 pending.add(line.script.isolate.removeBreakpoint(bpt)); |
| 297 } |
| 298 Future.wait(pending).then((_) { |
| 299 busy = false; |
| 296 }); | 300 }); |
| 297 } | 301 } |
| 298 } | 302 } |
| 299 | 303 |
| 300 BreakpointToggleElement.created() : super.created(); | 304 BreakpointToggleElement.created() : super.created(); |
| 301 } | 305 } |
| OLD | NEW |