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

Unified Diff: runtime/observatory/lib/src/elements/cpu_profile.dart

Issue 1837373002: Refactor call tree search to support both Code and Function trees (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: runtime/observatory/lib/src/elements/cpu_profile.dart
diff --git a/runtime/observatory/lib/src/elements/cpu_profile.dart b/runtime/observatory/lib/src/elements/cpu_profile.dart
index 6f74bbc2db792e703bffe0a627fae71223911493..2c8125c06a695ea506f5bd5f504b96e153c5f20a 100644
--- a/runtime/observatory/lib/src/elements/cpu_profile.dart
+++ b/runtime/observatory/lib/src/elements/cpu_profile.dart
@@ -588,6 +588,7 @@ class FunctionCallTreeNodeRow extends VirtualTreeRow {
}
void onRender(DivElement rowDiv) {
+ rowDiv.children.add(makeGap(ems:0.1));
rowDiv.children.add(
makeText(totalPercent, toolTip: 'global % on stack'));
rowDiv.children.add(makeGap());
@@ -640,6 +641,7 @@ class CodeCallTreeNodeRow extends VirtualTreeRow {
}
void onRender(DivElement rowDiv) {
+ rowDiv.children.add(makeGap(ems:0.1));
rowDiv.children.add(
makeText(totalPercent, toolTip: 'global % on stack'));
rowDiv.children.add(makeGap());
@@ -709,9 +711,8 @@ class CpuProfileElement extends ObservatoryElement {
var applySize = (e) {
Rectangle rect = e.getBoundingClientRect();
final totalHeight = window.innerHeight;
- final top = rect.top;
final bottomMargin = 200;
- final mainHeight = totalHeight - top - bottomMargin;
+ final mainHeight = totalHeight - bottomMargin;
e.style.setProperty('height', '${mainHeight}px');
};
HtmlElement e2 = $['cpuProfileVirtualTree'];
@@ -1272,11 +1273,22 @@ class CpuProfileVirtualTreeElement extends ObservatoryElement {
ProfileTreeMode mode = ProfileTreeMode.Function;
CpuProfile profile;
VirtualTree virtualTree;
- FunctionCallTreeNodeFilter functionFilter;
+ CallTreeNodeFilter filter;
+ StreamSubscription _resizeSubscription;
@observable bool show = true;
CpuProfileVirtualTreeElement.created() : super.created();
+ attached() {
+ super.attached();
+ _resizeSubscription = window.onResize.listen((_) => _updateSize());
+ }
+
+ detached() {
+ super.detached();
+ _resizeSubscription?.cancel();
+ }
+
void render() {
_updateView();
}
@@ -1288,6 +1300,7 @@ class CpuProfileVirtualTreeElement extends ObservatoryElement {
}
void _updateView() {
+ _updateSize();
virtualTree?.clear();
virtualTree?.uninstall();
virtualTree = null;
@@ -1301,6 +1314,13 @@ class CpuProfileVirtualTreeElement extends ObservatoryElement {
virtualTree?.refresh();
}
+ void _updateSize() {
+ var treeBody = shadowRoot.querySelector('#tree');
+ assert(treeBody != null);
+ int windowHeight = window.innerHeight - 32;
+ treeBody.style.height = '${windowHeight}px';
+ }
+
void _buildFunctionTree(bool exclusive) {
var treeBody = shadowRoot.querySelector('#tree');
assert(treeBody != null);
@@ -1312,8 +1332,8 @@ class CpuProfileVirtualTreeElement extends ObservatoryElement {
if (tree == null) {
return;
}
- if (functionFilter != null) {
- tree = tree.filtered(functionFilter);
+ if (filter != null) {
+ tree = tree.filtered(filter);
}
for (var child in tree.root.children) {
virtualTree.rows.add(
@@ -1335,6 +1355,9 @@ class CpuProfileVirtualTreeElement extends ObservatoryElement {
if (tree == null) {
return;
}
+ if (filter != null) {
+ tree = tree.filtered(filter);
+ }
for (var child in tree.root.children) {
virtualTree.rows.add(
new CodeCallTreeNodeRow(virtualTree, 0, profile, child));
@@ -1352,7 +1375,7 @@ class CpuProfileTreeElement extends ObservatoryElement {
CpuProfile profile;
TableTree codeTree;
TableTree functionTree;
- FunctionCallTreeNodeFilter functionFilter;
+ CallTreeNodeFilter functionFilter;
@observable bool show = true;
CpuProfileTreeElement.created() : super.created();
« no previous file with comments | « runtime/observatory/lib/src/cpu_profile/cpu_profile.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