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 import 'dart:async'; | 5 import 'dart:async'; |
6 import 'dart:html'; | 6 import 'dart:html'; |
7 import 'dart:math' as Math; | 7 import 'dart:math' as Math; |
8 import 'package:observatory/models.dart' as M; | 8 import 'package:observatory/models.dart' as M; |
9 import 'package:observatory/src/elements/stack_trace_tree_config.dart' | 9 import 'package:observatory/src/elements/stack_trace_tree_config.dart' |
10 show ProfileTreeMode; | 10 show ProfileTreeMode; |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 tree = filters.fold(tree, (tree, filter) { | 121 tree = filters.fold(tree, (tree, filter) { |
122 return tree?.filtered(filter); | 122 return tree?.filtered(filter); |
123 }); | 123 }); |
124 } | 124 } |
125 if (tree == null) { | 125 if (tree == null) { |
126 children = [new HeadingElement.h1()..text = 'No Results']; | 126 children = [new HeadingElement.h1()..text = 'No Results']; |
127 return; | 127 return; |
128 } | 128 } |
129 _tree = new VirtualTreeElement(create, update, _getChildren, | 129 _tree = new VirtualTreeElement(create, update, _getChildren, |
130 items: tree.root.children, queue: _r.queue); | 130 items: tree.root.children, queue: _r.queue); |
131 if (tree.root.children.length == 0) { | 131 if (tree.root.children.length == 1) { |
132 children = [ | |
133 new DivElement() | |
134 ..classes = ['tree-item'] | |
135 ..children = [new HeadingElement.h1()..text = 'No Samples'] | |
136 ]; | |
137 return; | |
138 } else if (tree.root.children.length == 1) { | |
139 _tree.expand(tree.root.children.first, autoExpandSingleChildNodes: true); | 132 _tree.expand(tree.root.children.first, autoExpandSingleChildNodes: true); |
140 } | 133 } |
141 children = [_tree]; | 134 children = [_tree]; |
142 } | 135 } |
143 | 136 |
144 static Element _createCpuRow(toggle) { | 137 static Element _createCpuRow(toggle) { |
145 return new DivElement() | 138 return new DivElement() |
146 ..classes = ['tree-item'] | 139 ..classes = ['tree-item'] |
147 ..children = [ | 140 ..children = [ |
148 new SpanElement() | 141 new SpanElement() |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 static _updateLines(List<Element> lines, int n) { | 270 static _updateLines(List<Element> lines, int n) { |
278 n = Math.max(0, n); | 271 n = Math.max(0, n); |
279 while (lines.length > n) { | 272 while (lines.length > n) { |
280 lines.removeLast(); | 273 lines.removeLast(); |
281 } | 274 } |
282 while (lines.length < n) { | 275 while (lines.length < n) { |
283 lines.add(new SpanElement()); | 276 lines.add(new SpanElement()); |
284 } | 277 } |
285 } | 278 } |
286 } | 279 } |
OLD | NEW |