OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 /// Client component to display [GlobalResult]s as a web app. | 5 /// Client component to display [GlobalResult]s as a web app. |
6 library dart2js_info.bin.inference.client; | 6 library dart2js_info.bin.inference.client; |
7 | 7 |
8 import 'dart:html' hide Entry; | 8 import 'dart:html' hide Entry; |
9 import 'dart:convert'; | 9 import 'dart:convert'; |
10 import 'package:dart2js_info/info.dart'; | 10 import 'package:dart2js_info/info.dart'; |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 } else if (contents.codeUnitAt(i) == $gt) { | 109 } else if (contents.codeUnitAt(i) == $gt) { |
110 code.replace(i, i + 1, '>'); | 110 code.replace(i, i + 1, '>'); |
111 } else if (contents.codeUnitAt(i) == $lf) { | 111 } else if (contents.codeUnitAt(i) == $lf) { |
112 code.insert(i + 1, '</span><span class="line">'); | 112 code.insert(i + 1, '</span><span class="line">'); |
113 } | 113 } |
114 } | 114 } |
115 code.insert(contents.length, '</span>'); | 115 code.insert(contents.length, '</span>'); |
116 } | 116 } |
117 | 117 |
118 @override | 118 @override |
119 visitFunction(FunctionInfo function) { | 119 Null visitFunction(FunctionInfo function) { |
120 if (function.measurements?.uri?.path != path) return; | 120 if (function.measurements?.uri?.path != path) return null; |
121 var entries = function.measurements.entries; | 121 var entries = function.measurements.entries; |
122 for (var metric in entries.keys) { | 122 for (var metric in entries.keys) { |
123 if (metric is GroupedMetric) continue; | 123 if (metric is GroupedMetric) continue; |
124 var cssClassName = _classNameForMetric(metric); | 124 var cssClassName = _classNameForMetric(metric); |
125 for (var entry in entries[metric]) { | 125 for (var entry in entries[metric]) { |
126 code.insert(entry.begin, '<span class="send ${cssClassName} inactive">', | 126 code.insert(entry.begin, '<span class="send ${cssClassName} inactive">', |
127 -entry.end); | 127 -entry.end); |
128 code.insert(entry.end, '</span>'); | 128 code.insert(entry.end, '</span>'); |
129 } | 129 } |
130 } | 130 } |
| 131 return null; |
131 } | 132 } |
132 } | 133 } |
133 | 134 |
134 _classNameForMetric(Metric metric) => metric.name.replaceAll(' ', '-'); | 135 _classNameForMetric(Metric metric) => metric.name.replaceAll(' ', '-'); |
OLD | NEW |