| 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 'dart:svg'; | 9 import 'dart:svg'; |
| 10 import 'package:observatory/app.dart'; | 10 import 'package:observatory/app.dart'; |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 e._startPos = startPos; | 65 e._startPos = startPos; |
| 66 e._endPos = endPos; | 66 e._endPos = endPos; |
| 67 e._currentPos = currentPos; | 67 e._currentPos = currentPos; |
| 68 e._inDebuggerContext = inDebuggerContext; | 68 e._inDebuggerContext = inDebuggerContext; |
| 69 e._variables = new List.unmodifiable(variables); | 69 e._variables = new List.unmodifiable(variables); |
| 70 return e; | 70 return e; |
| 71 } | 71 } |
| 72 | 72 |
| 73 ScriptInsetElement.created() : super.created(); | 73 ScriptInsetElement.created() : super.created(); |
| 74 | 74 |
| 75 bool get noSource => _startPos == -1; |
| 76 |
| 75 @override | 77 @override |
| 76 void attached() { | 78 void attached() { |
| 77 super.attached(); | 79 super.attached(); |
| 78 _r.enable(); | 80 _r.enable(); |
| 79 _subscription = _events.onDebugEvent | 81 _subscription = _events.onDebugEvent |
| 80 .where((e) => (e is M.BreakpointAddedEvent) || | 82 .where((e) => (e is M.BreakpointAddedEvent) || |
| 81 (e is M.BreakpointResolvedEvent) || | 83 (e is M.BreakpointResolvedEvent) || |
| 82 (e is M.BreakpointRemovedEvent)) | 84 (e is M.BreakpointRemovedEvent)) |
| 83 .map((e) => e.breakpoint) | 85 .map((e) => e.breakpoint) |
| 84 .listen((M.Breakpoint b) { | 86 .listen((M.Breakpoint b) { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 102 | 104 |
| 103 @override | 105 @override |
| 104 void detached() { | 106 void detached() { |
| 105 super.detached(); | 107 super.detached(); |
| 106 children = []; | 108 children = []; |
| 107 _r.disable(notify: true); | 109 _r.disable(notify: true); |
| 108 _subscription.cancel(); | 110 _subscription.cancel(); |
| 109 } | 111 } |
| 110 | 112 |
| 111 void render() { | 113 void render() { |
| 112 if (_loadedScript == null) { | 114 if (noSource) { |
| 115 children = [new SpanElement()..text = 'No source']; |
| 116 } else if (_loadedScript == null) { |
| 113 children = [new SpanElement()..text = 'Loading...']; | 117 children = [new SpanElement()..text = 'Loading...']; |
| 114 } else { | 118 } else { |
| 115 final table = linesTable(); | 119 final table = linesTable(); |
| 116 var firstBuild = false; | 120 var firstBuild = false; |
| 117 if (container == null) { | 121 if (container == null) { |
| 118 // Indirect to avoid deleting the style element. | 122 // Indirect to avoid deleting the style element. |
| 119 container = new DivElement(); | 123 container = new DivElement(); |
| 120 | 124 |
| 121 firstBuild = true; | 125 firstBuild = true; |
| 122 } | 126 } |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 Element hitsNotCompiled(Element element) { | 201 Element hitsNotCompiled(Element element) { |
| 198 element.classes.add('hitsNotCompiled'); | 202 element.classes.add('hitsNotCompiled'); |
| 199 element.title = "Line in uncompiled function"; | 203 element.title = "Line in uncompiled function"; |
| 200 return element; | 204 return element; |
| 201 } | 205 } |
| 202 | 206 |
| 203 Element container; | 207 Element container; |
| 204 | 208 |
| 205 // Build _rangeMap and _callSites from a source report. | 209 // Build _rangeMap and _callSites from a source report. |
| 206 Future _refreshSourceReport() async { | 210 Future _refreshSourceReport() async { |
| 211 if (noSource) return; |
| 212 |
| 207 var reports = [S.Isolate.kCallSitesReport, | 213 var reports = [S.Isolate.kCallSitesReport, |
| 208 S.Isolate.kPossibleBreakpointsReport]; | 214 S.Isolate.kPossibleBreakpointsReport]; |
| 209 if (_includeProfile) { | 215 if (_includeProfile) { |
| 210 reports.add(S.Isolate.kProfileReport); | 216 reports.add(S.Isolate.kProfileReport); |
| 211 } | 217 } |
| 212 S.Isolate isolate = _isolate as S.Isolate; | 218 S.Isolate isolate = _isolate as S.Isolate; |
| 213 var sourceReport = await isolate.getSourceReport( | 219 var sourceReport = await isolate.getSourceReport( |
| 214 reports, | 220 reports, |
| 215 script, _startPos, _endPos); | 221 script, _startPos, _endPos); |
| 216 _possibleBreakpointLines = S.getPossibleBreakpointLines(sourceReport, | 222 _possibleBreakpointLines = S.getPossibleBreakpointLines(sourceReport, |
| (...skipping 1154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1371 ..children = [ | 1377 ..children = [ |
| 1372 new PathElement() | 1378 new PathElement() |
| 1373 ..setAttribute('d', 'M13.5.67s.74 2.65.74 4.8c0 2.06-1.35 3.73-3.41 ' | 1379 ..setAttribute('d', 'M13.5.67s.74 2.65.74 4.8c0 2.06-1.35 3.73-3.41 ' |
| 1374 '3.73-2.07 0-3.63-1.67-3.63-3.73l.03-.36C5.21 7.51 ' | 1380 '3.73-2.07 0-3.63-1.67-3.63-3.73l.03-.36C5.21 7.51 ' |
| 1375 '4 10.62 4 14c0 4.42 3.58 8 8 8s8-3.58 8-8C20 8.61 ' | 1381 '4 10.62 4 14c0 4.42 3.58 8 8 8s8-3.58 8-8C20 8.61 ' |
| 1376 '17.41 3.8 13.5.67zM11.71 19c-1.78 ' | 1382 '17.41 3.8 13.5.67zM11.71 19c-1.78 ' |
| 1377 '0-3.22-1.4-3.22-3.14 0-1.62 1.05-2.76 2.81-3.12 ' | 1383 '0-3.22-1.4-3.22-3.14 0-1.62 1.05-2.76 2.81-3.12 ' |
| 1378 '1.77-.36 3.6-1.21 4.62-2.58.39 1.29.59 2.65.59 ' | 1384 '1.77-.36 3.6-1.21 4.62-2.58.39 1.29.59 2.65.59 ' |
| 1379 '4.04 0 2.65-2.15 4.8-4.8 4.8z') | 1385 '4.04 0 2.65-2.15 4.8-4.8 4.8z') |
| 1380 ]; | 1386 ]; |
| OLD | NEW |