| 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 == 1) { | 131 if (tree.root.children.length == 0) { |
| 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) { |
| 132 _tree.expand(tree.root.children.first, autoExpandSingleChildNodes: true); | 139 _tree.expand(tree.root.children.first, autoExpandSingleChildNodes: true); |
| 133 } | 140 } |
| 134 children = [_tree]; | 141 children = [_tree]; |
| 135 } | 142 } |
| 136 | 143 |
| 137 static Element _createCpuRow(toggle) { | 144 static Element _createCpuRow(toggle) { |
| 138 return new DivElement() | 145 return new DivElement() |
| 139 ..classes = ['tree-item'] | 146 ..classes = ['tree-item'] |
| 140 ..children = [ | 147 ..children = [ |
| 141 new SpanElement() | 148 new SpanElement() |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 static _updateLines(List<Element> lines, int n) { | 277 static _updateLines(List<Element> lines, int n) { |
| 271 n = Math.max(0, n); | 278 n = Math.max(0, n); |
| 272 while (lines.length > n) { | 279 while (lines.length > n) { |
| 273 lines.removeLast(); | 280 lines.removeLast(); |
| 274 } | 281 } |
| 275 while (lines.length < n) { | 282 while (lines.length < n) { |
| 276 lines.add(new SpanElement()); | 283 lines.add(new SpanElement()); |
| 277 } | 284 } |
| 278 } | 285 } |
| 279 } | 286 } |
| OLD | NEW |