Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(58)

Side by Side Diff: runtime/observatory/lib/src/elements/cpu_profile.dart

Issue 1290023002: Hide empty CPU profile on class page (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 cpu_profile_element; 5 library cpu_profile_element;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:html'; 8 import 'dart:html';
9 import 'observatory_element.dart'; 9 import 'observatory_element.dart';
10 import 'package:observatory/service.dart'; 10 import 'package:observatory/service.dart';
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 } 552 }
553 553
554 void directionSelectorChanged(oldValue) { 554 void directionSelectorChanged(oldValue) {
555 if (onTreeConfigChange == null) { 555 if (onTreeConfigChange == null) {
556 return; 556 return;
557 } 557 }
558 onTreeConfigChange(modeSelector, directionSelector); 558 onTreeConfigChange(modeSelector, directionSelector);
559 } 559 }
560 560
561 Function onTreeConfigChange; 561 Function onTreeConfigChange;
562 @observable bool show = true;
562 @observable bool showModeSelector = true; 563 @observable bool showModeSelector = true;
563 @observable bool showDirectionSelector = true; 564 @observable bool showDirectionSelector = true;
564 @observable String modeSelector = 'Function'; 565 @observable String modeSelector = 'Function';
565 @observable String directionSelector = 'Up'; 566 @observable String directionSelector = 'Up';
566 } 567 }
567 568
568 /// Displays a CpuProfile 569 /// Displays a CpuProfile
569 @CustomTag('cpu-profile') 570 @CustomTag('cpu-profile')
570 class CpuProfileElement extends ObservatoryElement { 571 class CpuProfileElement extends ObservatoryElement {
571 CpuProfileElement.created() : super.created() { 572 CpuProfileElement.created() : super.created() {
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after
1118 } 1119 }
1119 1120
1120 @CustomTag('cpu-profile-tree') 1121 @CustomTag('cpu-profile-tree')
1121 class CpuProfileTreeElement extends ObservatoryElement { 1122 class CpuProfileTreeElement extends ObservatoryElement {
1122 ProfileTreeDirection direction = ProfileTreeDirection.Exclusive; 1123 ProfileTreeDirection direction = ProfileTreeDirection.Exclusive;
1123 ProfileTreeMode mode = ProfileTreeMode.Function; 1124 ProfileTreeMode mode = ProfileTreeMode.Function;
1124 CpuProfile profile; 1125 CpuProfile profile;
1125 TableTree codeTree; 1126 TableTree codeTree;
1126 TableTree functionTree; 1127 TableTree functionTree;
1127 FunctionCallTreeNodeFilter functionFilter; 1128 FunctionCallTreeNodeFilter functionFilter;
1129 @observable bool show = true;
1128 1130
1129 CpuProfileTreeElement.created() : super.created(); 1131 CpuProfileTreeElement.created() : super.created();
1130 1132
1131 void render() { 1133 void render() {
1132 _updateView(); 1134 _updateView();
1133 } 1135 }
1134 1136
1137 showChanged(oldValue) {
1138 var treeTable = shadowRoot.querySelector('#treeTable');
1139 assert(treeTable != null);
1140 treeTable.style.display = show ? 'table' : 'none';
1141 }
1142
1135 void _updateView() { 1143 void _updateView() {
1136 if (functionTree != null) { 1144 if (functionTree != null) {
1137 functionTree.clear(); 1145 functionTree.clear();
1138 functionTree = null; 1146 functionTree = null;
1139 } 1147 }
1140 if (codeTree != null) { 1148 if (codeTree != null) {
1141 codeTree.clear(); 1149 codeTree.clear();
1142 codeTree = null; 1150 codeTree = null;
1143 } 1151 }
1144 bool exclusive = direction == ProfileTreeDirection.Exclusive; 1152 bool exclusive = direction == ProfileTreeDirection.Exclusive;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1181 return; 1189 return;
1182 } 1190 }
1183 var tree = profile.loadCodeTree(exclusive ? 'exclusive' : 'inclusive'); 1191 var tree = profile.loadCodeTree(exclusive ? 'exclusive' : 'inclusive');
1184 if (tree == null) { 1192 if (tree == null) {
1185 return; 1193 return;
1186 } 1194 }
1187 var rootRow = new CodeProfileTreeRow(codeTree, null, profile, tree.root); 1195 var rootRow = new CodeProfileTreeRow(codeTree, null, profile, tree.root);
1188 codeTree.initialize(rootRow); 1196 codeTree.initialize(rootRow);
1189 } 1197 }
1190 } 1198 }
OLDNEW
« no previous file with comments | « runtime/observatory/lib/src/elements/class_view.dart ('k') | runtime/observatory/lib/src/elements/cpu_profile.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698