Chromium Code Reviews| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 42 Iterable<M.CallTreeNodeFilter> get filters => _filters; | 42 Iterable<M.CallTreeNodeFilter> get filters => _filters; |
| 43 | 43 |
| 44 set direction(M.ProfileTreeDirection value) => | 44 set direction(M.ProfileTreeDirection value) => |
| 45 _direction = _r.checkAndReact(_direction, value); | 45 _direction = _r.checkAndReact(_direction, value); |
| 46 set mode(ProfileTreeMode value) => _mode = _r.checkAndReact(_mode, value); | 46 set mode(ProfileTreeMode value) => _mode = _r.checkAndReact(_mode, value); |
| 47 set filters(Iterable<M.CallTreeNodeFilter> value) { | 47 set filters(Iterable<M.CallTreeNodeFilter> value) { |
| 48 _filters = new List.unmodifiable(value); | 48 _filters = new List.unmodifiable(value); |
| 49 _r.dirty(); | 49 _r.dirty(); |
| 50 } | 50 } |
| 51 | 51 |
| 52 factory CpuProfileVirtualTreeElement( | 52 factory CpuProfileVirtualTreeElement(Object owner, M.SampleProfile profile, |
| 53 M.IsolateRef isolate, M.SampleProfile profile, | |
| 54 {ProfileTreeMode mode: ProfileTreeMode.function, | 53 {ProfileTreeMode mode: ProfileTreeMode.function, |
| 55 M.SampleProfileType type: M.SampleProfileType.cpu, | 54 M.SampleProfileType type: M.SampleProfileType.cpu, |
| 56 M.ProfileTreeDirection direction: M.ProfileTreeDirection.exclusive, | 55 M.ProfileTreeDirection direction: M.ProfileTreeDirection.exclusive, |
| 57 RenderingQueue queue}) { | 56 RenderingQueue queue}) { |
| 58 assert(profile != null); | 57 assert(profile != null); |
| 59 assert(mode != null); | 58 assert(mode != null); |
| 60 assert(direction != null); | 59 assert(direction != null); |
| 61 CpuProfileVirtualTreeElement e = document.createElement(tag.name); | 60 CpuProfileVirtualTreeElement e = document.createElement(tag.name); |
| 62 e._r = new RenderingScheduler(e, queue: queue); | 61 e._r = new RenderingScheduler(e, queue: queue); |
| 63 e._isolate = isolate; | 62 e._isolate = owner; |
| 64 e._profile = profile; | 63 e._profile = profile; |
| 65 e._mode = mode; | 64 e._mode = mode; |
| 66 e._type = type; | 65 e._type = type; |
| 67 e._direction = direction; | 66 e._direction = direction; |
| 68 return e; | 67 return e; |
| 69 } | 68 } |
| 70 | 69 |
| 71 CpuProfileVirtualTreeElement.created() : super.created(); | 70 CpuProfileVirtualTreeElement.created() : super.created(); |
| 72 | 71 |
| 73 @override | 72 @override |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 110 tree = _profile.loadCodeTree(_direction); | 109 tree = _profile.loadCodeTree(_direction); |
| 111 } else if (mode == ProfileTreeMode.function) { | 110 } else if (mode == ProfileTreeMode.function) { |
| 112 update = _updateMemoryFunctionRow; | 111 update = _updateMemoryFunctionRow; |
| 113 tree = _profile.loadFunctionTree(_direction); | 112 tree = _profile.loadFunctionTree(_direction); |
| 114 } else { | 113 } else { |
| 115 throw new Exception('Unknown ProfileTreeMode: $mode'); | 114 throw new Exception('Unknown ProfileTreeMode: $mode'); |
| 116 } | 115 } |
| 117 break; | 116 break; |
| 118 default: | 117 default: |
| 119 throw new Exception('Unknown SampleProfileType: $type'); | 118 throw new Exception('Unknown SampleProfileType: $type'); |
| 120 break; | |
|
rmacnak
2017/03/29 17:20:44
I think the analyzer has gone back and forth on wh
| |
| 121 } | 119 } |
| 122 if (filters != null) { | 120 if (filters != null) { |
| 123 tree = filters.fold(tree, (tree, filter) { | 121 tree = filters.fold(tree, (tree, filter) { |
| 124 return tree?.filtered(filter); | 122 return tree?.filtered(filter); |
| 125 }); | 123 }); |
| 126 } | 124 } |
| 127 if (tree == null) { | 125 if (tree == null) { |
| 128 children = [new HeadingElement.h1()..text = 'No Results']; | 126 children = [new HeadingElement.h1()..text = 'No Results']; |
| 129 return; | 127 return; |
| 130 } | 128 } |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 268 static _updateLines(List<Element> lines, int n) { | 266 static _updateLines(List<Element> lines, int n) { |
| 269 n = Math.max(0, n); | 267 n = Math.max(0, n); |
| 270 while (lines.length > n) { | 268 while (lines.length > n) { |
| 271 lines.removeLast(); | 269 lines.removeLast(); |
| 272 } | 270 } |
| 273 while (lines.length < n) { | 271 while (lines.length < n) { |
| 274 lines.add(new SpanElement()); | 272 lines.add(new SpanElement()); |
| 275 } | 273 } |
| 276 } | 274 } |
| 277 } | 275 } |
| OLD | NEW |