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

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

Issue 2298563002: Removed const from classes arrays in Observatory (Closed)
Patch Set: Created 4 years, 3 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 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 report.add(_tree); 259 report.add(_tree);
260 break; 260 break;
261 default: 261 default:
262 break; 262 break;
263 } 263 }
264 return report; 264 return report;
265 } 265 }
266 266
267 static Element _createDominator(toggle) { 267 static Element _createDominator(toggle) {
268 return new DivElement() 268 return new DivElement()
269 ..classes = const ['tree-item'] 269 ..classes = ['tree-item']
270 ..children = [ 270 ..children = [
271 new SpanElement()..classes = const ['size'] 271 new SpanElement()..classes = ['size']
272 ..title = 'retained size', 272 ..title = 'retained size',
273 new SpanElement()..classes = const ['lines'], 273 new SpanElement()..classes = ['lines'],
274 new ButtonElement()..classes = const ['expander'] 274 new ButtonElement()..classes = ['expander']
275 ..onClick.listen((_) => toggle(autoToggleSingleChildNodes: true)), 275 ..onClick.listen((_) => toggle(autoToggleSingleChildNodes: true)),
276 new SpanElement()..classes = const ['percentage'] 276 new SpanElement()..classes = ['percentage']
277 ..title = 'percentage of heap being retained', 277 ..title = 'percentage of heap being retained',
278 new SpanElement()..classes = const ['name'] 278 new SpanElement()..classes = ['name']
279 ]; 279 ];
280 } 280 }
281 281
282 static Element _createGroup(toggle) { 282 static Element _createGroup(toggle) {
283 return new DivElement() 283 return new DivElement()
284 ..classes = const ['tree-item'] 284 ..classes = ['tree-item']
285 ..children = [ 285 ..children = [
286 new SpanElement()..classes = const ['size'] 286 new SpanElement()..classes = ['size']
287 ..title = 'shallow size', 287 ..title = 'shallow size',
288 new SpanElement()..classes = const ['lines'], 288 new SpanElement()..classes = ['lines'],
289 new ButtonElement()..classes = const ['expander'] 289 new ButtonElement()..classes = ['expander']
290 ..onClick.listen((_) => toggle(autoToggleSingleChildNodes: true)), 290 ..onClick.listen((_) => toggle(autoToggleSingleChildNodes: true)),
291 new SpanElement()..classes = const ['count'] 291 new SpanElement()..classes = ['count']
292 ..title = 'shallow size', 292 ..title = 'shallow size',
293 new SpanElement()..classes = const ['name'] 293 new SpanElement()..classes = ['name']
294 ]; 294 ];
295 } 295 }
296 296
297 static const int kMaxChildren = 100; 297 static const int kMaxChildren = 100;
298 static const int kMinRetainedSize = 4096; 298 static const int kMinRetainedSize = 4096;
299 299
300 static _getChildrenDominator(M.HeapSnapshotDominatorNode node) { 300 static _getChildrenDominator(M.HeapSnapshotDominatorNode node) {
301 final list = node.children.toList(); 301 final list = node.children.toList();
302 list.sort((a, b) => b.retainedSize - a.retainedSize); 302 list.sort((a, b) => b.retainedSize - a.retainedSize);
303 return list.where((child) => child.retainedSize >= kMinRetainedSize) 303 return list.where((child) => child.retainedSize >= kMinRetainedSize)
(...skipping 15 matching lines...) Expand all
319 int depth) { 319 int depth) {
320 element.children[0].text = Utils.formatSize(node.retainedSize); 320 element.children[0].text = Utils.formatSize(node.retainedSize);
321 _updateLines(element.children[1].children, depth); 321 _updateLines(element.children[1].children, depth);
322 if (_getChildrenDominator(node).isNotEmpty) { 322 if (_getChildrenDominator(node).isNotEmpty) {
323 element.children[2].text = _tree.isExpanded(node) ? '▼' : '►'; 323 element.children[2].text = _tree.isExpanded(node) ? '▼' : '►';
324 } else { 324 } else {
325 element.children[2].text = ''; 325 element.children[2].text = '';
326 } 326 }
327 element.children[3].text = Utils.formatPercentNormalized( 327 element.children[3].text = Utils.formatPercentNormalized(
328 node.retainedSize * 1.0 / _snapshot.size); 328 node.retainedSize * 1.0 / _snapshot.size);
329 final wrapper = new SpanElement()..classes = const ['name'] 329 final wrapper = new SpanElement()..classes = ['name']
330 ..text = 'Loading...'; 330 ..text = 'Loading...';
331 element.children[4] = wrapper; 331 element.children[4] = wrapper;
332 node.object.then((object) { 332 node.object.then((object) {
333 wrapper..text = '' 333 wrapper..text = ''
334 ..children = [anyRef(_isolate, object, _instances, queue: _r.queue)]; 334 ..children = [anyRef(_isolate, object, _instances, queue: _r.queue)];
335 }); 335 });
336 } 336 }
337 337
338 void _updateGroup(HtmlElement element, item, int depth) { 338 void _updateGroup(HtmlElement element, item, int depth) {
339 _updateLines(element.children[1].children, depth); 339 _updateLines(element.children[1].children, depth);
340 if (item is M.HeapSnapshotClassReferences) { 340 if (item is M.HeapSnapshotClassReferences) {
341 element.children[0].text = Utils.formatSize(item.shallowSize); 341 element.children[0].text = Utils.formatSize(item.shallowSize);
342 element.children[2].text = _tree.isExpanded(item) ? '▼' : '►'; 342 element.children[2].text = _tree.isExpanded(item) ? '▼' : '►';
343 element.children[3].text = '${item.instances} instances of '; 343 element.children[3].text = '${item.instances} instances of ';
344 element.children[4] = new ClassRefElement(_isolate, item.clazz, 344 element.children[4] = new ClassRefElement(_isolate, item.clazz,
345 queue: _r.queue)..classes = const ['name']; 345 queue: _r.queue)..classes = ['name'];
346 } else if (item is Iterable) { 346 } else if (item is Iterable) {
347 element.children[0].text = ''; 347 element.children[0].text = '';
348 if (item.isNotEmpty) { 348 if (item.isNotEmpty) {
349 element.children[2].text = _tree.isExpanded(item) ? '▼' : '►'; 349 element.children[2].text = _tree.isExpanded(item) ? '▼' : '►';
350 } else { 350 } else {
351 element.children[2].text = ''; 351 element.children[2].text = '';
352 } 352 }
353 element.children[3].text = ''; 353 element.children[3].text = '';
354 if (item is Iterable<M.HeapSnapshotClassInbound>) { 354 if (item is Iterable<M.HeapSnapshotClassInbound>) {
355 element.children[4] = new SpanElement()..classes = const ['name'] 355 element.children[4] = new SpanElement()..classes = ['name']
356 ..text = '${item.length} Incoming references'; 356 ..text = '${item.length} Incoming references';
357 } else { 357 } else {
358 element.children[4] = new SpanElement()..classes = const ['name'] 358 element.children[4] = new SpanElement()..classes = ['name']
359 ..text = '${item.length} Outgoing references'; 359 ..text = '${item.length} Outgoing references';
360 } 360 }
361 } else { 361 } else {
362 element.children[0].text = ''; 362 element.children[0].text = '';
363 element.children[2].text = ''; 363 element.children[2].text = '';
364 element.children[3].text = ''; 364 element.children[3].text = '';
365 element.children[4] = new SpanElement()..classes = const ['name']; 365 element.children[4] = new SpanElement()..classes = ['name'];
366 if (item is M.HeapSnapshotClassInbound){ 366 if (item is M.HeapSnapshotClassInbound){
367 element.children[3].text = 367 element.children[3].text =
368 '${item.count} references from instances of '; 368 '${item.count} references from instances of ';
369 element.children[4].children = [ 369 element.children[4].children = [
370 new ClassRefElement(_isolate, item.source, 370 new ClassRefElement(_isolate, item.source,
371 queue: _r.queue) 371 queue: _r.queue)
372 ]; 372 ];
373 } else if (item is M.HeapSnapshotClassOutbound){ 373 } else if (item is M.HeapSnapshotClassOutbound){
374 element.children[3]..text = '${item.count} references to instances of '; 374 element.children[3]..text = '${item.count} references to instances of ';
375 element.children[4].children = [ 375 element.children[4].children = [
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 selected: _mode == mode) 408 selected: _mode == mode)
409 ..text = modeToString(mode); 409 ..text = modeToString(mode);
410 }).toList(growable: false) 410 }).toList(growable: false)
411 ..onChange.listen((_) { 411 ..onChange.listen((_) {
412 _mode = HeapSnapshotTreeMode.values[s.selectedIndex]; 412 _mode = HeapSnapshotTreeMode.values[s.selectedIndex];
413 _r.dirty(); 413 _r.dirty();
414 }) 414 })
415 ]; 415 ];
416 } 416 }
417 } 417 }
OLDNEW
« no previous file with comments | « runtime/observatory/lib/src/elements/heap_map.dart ('k') | runtime/observatory/lib/src/elements/icdata_view.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698