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

Side by Side Diff: runtime/observatory/lib/src/elements/class_view.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
« no previous file with comments | « no previous file | runtime/observatory/lib/src/elements/cpu_profile.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 class_view_element; 5 library class_view_element;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'observatory_element.dart'; 8 import 'observatory_element.dart';
9 import 'package:observatory/cpu_profile.dart'; 9 import 'package:observatory/cpu_profile.dart';
10 import 'package:observatory/elements.dart'; 10 import 'package:observatory/elements.dart';
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 sampleBufferControlElement = 55 sampleBufferControlElement =
56 shadowRoot.querySelector('#sampleBufferControl'); 56 shadowRoot.querySelector('#sampleBufferControl');
57 assert(sampleBufferControlElement != null); 57 assert(sampleBufferControlElement != null);
58 sampleBufferControlElement.onSampleBufferUpdate = onSampleBufferChange; 58 sampleBufferControlElement.onSampleBufferUpdate = onSampleBufferChange;
59 sampleBufferControlElement.state = 59 sampleBufferControlElement.state =
60 SampleBufferControlElement.kNotLoadedState; 60 SampleBufferControlElement.kNotLoadedState;
61 stackTraceTreeConfigElement = 61 stackTraceTreeConfigElement =
62 shadowRoot.querySelector('#stackTraceTreeConfig'); 62 shadowRoot.querySelector('#stackTraceTreeConfig');
63 assert(stackTraceTreeConfigElement != null); 63 assert(stackTraceTreeConfigElement != null);
64 stackTraceTreeConfigElement.onTreeConfigChange = onTreeConfigChange; 64 stackTraceTreeConfigElement.onTreeConfigChange = onTreeConfigChange;
65 stackTraceTreeConfigElement.show = false;
65 cpuProfileTreeElement = shadowRoot.querySelector('#cpuProfileTree'); 66 cpuProfileTreeElement = shadowRoot.querySelector('#cpuProfileTree');
66 assert(cpuProfileTreeElement != null); 67 assert(cpuProfileTreeElement != null);
67 cpuProfileTreeElement.profile = sampleBufferControlElement.profile; 68 cpuProfileTreeElement.profile = sampleBufferControlElement.profile;
69 cpuProfileTreeElement.show = false;
68 cls.fields.forEach((field) => field.reload()); 70 cls.fields.forEach((field) => field.reload());
69 sampleBufferControlElement.allocationProfileClass = cls; 71 sampleBufferControlElement.allocationProfileClass = cls;
70 } 72 }
71 73
72 Future refresh() { 74 Future refresh() {
73 instances = null; 75 instances = null;
74 retainedBytes = null; 76 retainedBytes = null;
75 mostRetained = null; 77 mostRetained = null;
76 var loads = []; 78 var loads = [];
77 loads.add(cls.reload()); 79 loads.add(cls.reload());
78 cls.fields.forEach((field) => loads.add(field.reload())); 80 cls.fields.forEach((field) => loads.add(field.reload()));
79 return Future.wait(loads); 81 return Future.wait(loads);
80 } 82 }
81 83
82 Future refreshCoverage() { 84 Future refreshCoverage() {
83 return cls.refreshCoverage(); 85 return cls.refreshCoverage();
84 } 86 }
85 87
86 onSampleBufferChange(CpuProfile sampleBuffer) { 88 onSampleBufferChange(CpuProfile sampleBuffer) {
89 stackTraceTreeConfigElement.show = sampleBuffer.sampleCount > 0;
90 cpuProfileTreeElement.show = sampleBuffer.sampleCount > 0;
87 cpuProfileTreeElement.render(); 91 cpuProfileTreeElement.render();
88 } 92 }
89 93
90 onTreeConfigChange(String modeSelector, String directionSelector) { 94 onTreeConfigChange(String modeSelector, String directionSelector) {
91 ProfileTreeDirection direction = ProfileTreeDirection.Exclusive; 95 ProfileTreeDirection direction = ProfileTreeDirection.Exclusive;
92 if (directionSelector != 'Up') { 96 if (directionSelector != 'Up') {
93 direction = ProfileTreeDirection.Inclusive; 97 direction = ProfileTreeDirection.Inclusive;
94 } 98 }
95 ProfileTreeMode mode = ProfileTreeMode.Function; 99 ProfileTreeMode mode = ProfileTreeMode.Function;
96 if (modeSelector == 'Code') { 100 if (modeSelector == 'Code') {
97 mode = ProfileTreeMode.Code; 101 mode = ProfileTreeMode.Code;
98 } 102 }
99 cpuProfileTreeElement.direction = direction; 103 cpuProfileTreeElement.direction = direction;
100 cpuProfileTreeElement.mode = mode; 104 cpuProfileTreeElement.mode = mode;
101 cpuProfileTreeElement.render(); 105 cpuProfileTreeElement.render();
102 } 106 }
103 107
104 Future refreshAllocationProfile() async { 108 Future refreshAllocationProfile() async {
105 return sampleBufferControlElement.reload(cls.isolate); 109 return sampleBufferControlElement.reload(cls.isolate);
106 } 110 }
107 111
108 Future toggleAllocationTrace() { 112 Future toggleAllocationTrace() {
109 if (cls == null) { 113 if (cls == null) {
110 return new Future(refresh); 114 return new Future(refresh);
111 } 115 }
112 return cls.setTraceAllocations(!cls.traceAllocations).whenComplete(refresh); 116 return cls.setTraceAllocations(!cls.traceAllocations).whenComplete(refresh);
113 } 117 }
114 } 118 }
OLDNEW
« no previous file with comments | « no previous file | runtime/observatory/lib/src/elements/cpu_profile.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698