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

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

Issue 2767533002: Revert "Fix observatory tests broken by running dartfmt." (Closed)
Patch Set: Created 3 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 5 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
6 // for details. All rights reserved. Use of this source code is governed by a 6 // for details. All rights reserved. Use of this source code is governed by a
7 // BSD-style license that can be found in the LICENSE file. 7 // BSD-style license that can be found in the LICENSE file.
8 8
9 import 'dart:async'; 9 import 'dart:async';
10 import 'dart:html'; 10 import 'dart:html';
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 break; 133 break;
134 case M.HeapSnapshotLoadingStatus.loaded: 134 case M.HeapSnapshotLoadingStatus.loaded:
135 content.addAll(_createReport()); 135 content.addAll(_createReport());
136 break; 136 break;
137 } 137 }
138 children = content; 138 children = content;
139 } 139 }
140 140
141 Future _refresh() async { 141 Future _refresh() async {
142 _progress = null; 142 _progress = null;
143 _progressStream = _snapshots.get(isolate, roots: _roots, gc: true); 143 _progressStream = _snapshots.get(isolate,
144 roots: _roots,
145 gc: true);
144 _r.dirty(); 146 _r.dirty();
145 _progressStream.listen((e) { 147 _progressStream.listen((e) {
146 _progress = e.progress; 148 _progress = e.progress;
147 _r.dirty(); 149 _r.dirty();
148 }); 150 });
149 _progress = (await _progressStream.first).progress; 151 _progress = (await _progressStream.first).progress;
150 _r.dirty(); 152 _r.dirty();
151 if (M.isHeapSnapshotProgressRunning(_progress.status)) { 153 if (M.isHeapSnapshotProgressRunning(_progress.status)) {
152 _progress = (await _progressStream.last).progress; 154 _progress = (await _progressStream.last).progress;
153 _snapshot = _progress.snapshot; 155 _snapshot = _progress.snapshot;
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 'that would be freed if the object became garbage.'; 274 'that would be freed if the object became garbage.';
273 report.addAll([ 275 report.addAll([
274 new DivElement() 276 new DivElement()
275 ..classes = ['content-centered-big', 'explanation'] 277 ..classes = ['content-centered-big', 'explanation']
276 ..text = text 278 ..text = text
277 ..title = text, 279 ..title = text,
278 _tree 280 _tree
279 ]); 281 ]);
280 break; 282 break;
281 case HeapSnapshotTreeMode.mergedDominatorTree: 283 case HeapSnapshotTreeMode.mergedDominatorTree:
282 _tree = new VirtualTreeElement(_createMergedDominator, 284 _tree = new VirtualTreeElement(
283 _updateMergedDominator, _getChildrenMergedDominator, 285 _createMergedDominator, _updateMergedDominator,
286 _getChildrenMergedDominator,
284 items: _getChildrenMergedDominator(_snapshot.mergedDominatorTree), 287 items: _getChildrenMergedDominator(_snapshot.mergedDominatorTree),
285 queue: _r.queue); 288 queue: _r.queue);
286 _tree.expand(_snapshot.mergedDominatorTree); 289 _tree.expand(_snapshot.mergedDominatorTree);
287 final text = 'A heap dominator tree, where siblings with the same class' 290 final text = 'A heap dominator tree, where siblings with the same class'
288 ' have been merged into a single node.'; 291 ' have been merged into a single node.';
289 report.addAll([ 292 report.addAll([
290 new DivElement() 293 new DivElement()
291 ..classes = ['content-centered-big', 'explanation'] 294 ..classes = ['content-centered-big', 'explanation']
292 ..text = text 295 ..text = text
293 ..title = text, 296 ..title = text,
294 _tree 297 _tree
295 ]); 298 ]);
296 break; 299 break;
297 case HeapSnapshotTreeMode.groupByClass: 300 case HeapSnapshotTreeMode.groupByClass:
298 final items = _snapshot.classReferences.toList(); 301 final items = _snapshot.classReferences.toList();
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 static const int kMaxChildren = 100; 369 static const int kMaxChildren = 100;
367 static const int kMinRetainedSize = 4096; 370 static const int kMinRetainedSize = 4096;
368 371
369 static _getChildrenDominator(M.HeapSnapshotDominatorNode node) { 372 static _getChildrenDominator(M.HeapSnapshotDominatorNode node) {
370 final list = node.children.toList(); 373 final list = node.children.toList();
371 list.sort((a, b) => b.retainedSize - a.retainedSize); 374 list.sort((a, b) => b.retainedSize - a.retainedSize);
372 return list 375 return list
373 .where((child) => child.retainedSize >= kMinRetainedSize) 376 .where((child) => child.retainedSize >= kMinRetainedSize)
374 .take(kMaxChildren); 377 .take(kMaxChildren);
375 } 378 }
376
377 static _getChildrenMergedDominator(M.HeapSnapshotMergedDominatorNode node) { 379 static _getChildrenMergedDominator(M.HeapSnapshotMergedDominatorNode node) {
378 final list = node.children.toList(); 380 final list = node.children.toList();
379 list.sort((a, b) => b.retainedSize - a.retainedSize); 381 list.sort((a, b) => b.retainedSize - a.retainedSize);
380 return list 382 return list
381 .where((child) => child.retainedSize >= kMinRetainedSize) 383 .where((child) => child.retainedSize >= kMinRetainedSize)
382 .take(kMaxChildren); 384 .take(kMaxChildren);
383 } 385 }
384 386
385 static _getChildrenGroup(item) { 387 static _getChildrenGroup(item) {
386 if (item is M.HeapSnapshotClassReferences) { 388 if (item is M.HeapSnapshotClassReferences) {
(...skipping 18 matching lines...) Expand all
405 element.children[3].text = 407 element.children[3].text =
406 Utils.formatPercentNormalized(node.retainedSize * 1.0 / _snapshot.size); 408 Utils.formatPercentNormalized(node.retainedSize * 1.0 / _snapshot.size);
407 final wrapper = new SpanElement() 409 final wrapper = new SpanElement()
408 ..classes = ['name'] 410 ..classes = ['name']
409 ..text = 'Loading...'; 411 ..text = 'Loading...';
410 element.children[4] = wrapper; 412 element.children[4] = wrapper;
411 if (node.isStack) { 413 if (node.isStack) {
412 wrapper 414 wrapper
413 ..text = '' 415 ..text = ''
414 ..children = [ 416 ..children = [
415 new AnchorElement(href: Uris.debugger(isolate))..text = 'stack frames' 417 new AnchorElement(href: Uris.debugger(isolate))
418 ..text = 'stack frames'
416 ]; 419 ];
417 } else { 420 } else {
418 node.object.then((object) { 421 node.object.then((object) {
419 wrapper 422 wrapper
420 ..text = '' 423 ..text = ''
421 ..children = [anyRef(_isolate, object, _instances, queue: _r.queue)]; 424 ..children = [anyRef(_isolate, object, _instances, queue: _r.queue)];
422 }); 425 });
423 } 426 }
424 } 427 }
425 428
426 void _updateMergedDominator( 429 void _updateMergedDominator(
427 HtmlElement element, M.HeapSnapshotMergedDominatorNode node, int depth) { 430 HtmlElement element, M.HeapSnapshotMergedDominatorNode node, int depth) {
428 element.children[0].text = Utils.formatSize(node.retainedSize); 431 element.children[0].text = Utils.formatSize(node.retainedSize);
429 _updateLines(element.children[1].children, depth); 432 _updateLines(element.children[1].children, depth);
430 if (_getChildrenMergedDominator(node).isNotEmpty) { 433 if (_getChildrenMergedDominator(node).isNotEmpty) {
431 element.children[2].text = _tree.isExpanded(node) ? '▼' : '►'; 434 element.children[2].text = _tree.isExpanded(node) ? '▼' : '►';
432 } else { 435 } else {
433 element.children[2].text = ''; 436 element.children[2].text = '';
434 } 437 }
435 element.children[3].text = 438 element.children[3].text =
436 Utils.formatPercentNormalized(node.retainedSize * 1.0 / _snapshot.size); 439 Utils.formatPercentNormalized(node.retainedSize * 1.0 / _snapshot.size);
437 final wrapper = new SpanElement() 440 final wrapper = new SpanElement()
438 ..classes = ['name'] 441 ..classes = ['name']
439 ..text = 'Loading...'; 442 ..text = 'Loading...';
440 element.children[4] = wrapper; 443 element.children[4] = wrapper;
441 if (node.isStack) { 444 if (node.isStack) {
442 wrapper 445 wrapper
443 ..text = '' 446 ..text = ''
444 ..children = [ 447 ..children = [
445 new AnchorElement(href: Uris.debugger(isolate))..text = 'stack frames' 448 new AnchorElement(href: Uris.debugger(isolate))
449 ..text = 'stack frames'
446 ]; 450 ];
447 } else { 451 } else {
448 node.klass.then((klass) { 452 node.klass.then((klass) {
449 wrapper 453 wrapper
450 ..text = '' 454 ..text = ''
451 ..children = [ 455 ..children = [
452 new SpanElement()..text = '${node.instanceCount} instances of ', 456 new SpanElement()..text = '${node.instanceCount} instances of ',
453 anyRef(_isolate, klass, _instances, queue: _r.queue) 457 anyRef(_isolate, klass, _instances, queue: _r.queue)
454 ]; 458 ];
455 }); 459 });
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 value: modeToString(mode), 570 value: modeToString(mode),
567 selected: _mode == mode)..text = modeToString(mode); 571 selected: _mode == mode)..text = modeToString(mode);
568 }).toList(growable: false) 572 }).toList(growable: false)
569 ..onChange.listen((_) { 573 ..onChange.listen((_) {
570 _mode = HeapSnapshotTreeMode.values[s.selectedIndex]; 574 _mode = HeapSnapshotTreeMode.values[s.selectedIndex];
571 _r.dirty(); 575 _r.dirty();
572 }) 576 })
573 ]; 577 ];
574 } 578 }
575 } 579 }
OLDNEW
« no previous file with comments | « runtime/observatory/lib/src/elements/debugger.dart ('k') | runtime/observatory/lib/src/elements/isolate_view.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698