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

Side by Side Diff: runtime/bin/vmservice/client/lib/src/elements/heap_map.dart

Issue 237683004: Disable applyAuthorStyles (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 heap_map_element; 5 library heap_map_element;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:html'; 8 import 'dart:html';
9 import 'dart:math'; 9 import 'dart:math';
10 import 'observatory_element.dart'; 10 import 'observatory_element.dart';
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 // Encode color as single integer, to enable using it as a map key. 71 // Encode color as single integer, to enable using it as a map key.
72 int _packColor(Iterable<int> color) { 72 int _packColor(Iterable<int> color) {
73 int packed = 0; 73 int packed = 0;
74 for (var component in color) { 74 for (var component in color) {
75 packed = packed * 256 + component; 75 packed = packed * 256 + component;
76 } 76 }
77 return packed; 77 return packed;
78 } 78 }
79 79
80 void _addClass(int classId, String name, Iterable<int> color) { 80 void _addClass(int classId, String name, Iterable<int> color) {
81 _classIdToName[classId] = name; 81 _classIdToName[classId] = name.split('@')[0];
82 _classIdToColor[classId] = color; 82 _classIdToColor[classId] = color;
83 _colorToClassId[_packColor(color)] = classId; 83 _colorToClassId[_packColor(color)] = classId;
84 } 84 }
85 85
86 void _updateClassList(classList, int freeClassId) { 86 void _updateClassList(classList, int freeClassId) {
87 for (var member in classList['members']) { 87 for (var member in classList['members']) {
88 if (member['type'] != '@Class') { 88 if (member['type'] != '@Class') {
89 Logger.root.info('$member'); 89 Logger.root.info('$member');
90 continue; 90 continue;
91 } 91 }
92 var classId = int.parse(member['id'].split('/').last); 92 var classId = int.parse(member['id'].split('/').last);
93 var color = _classIdToRGBA(classId); 93 var color = _classIdToRGBA(classId);
94 _addClass(classId, member['user_name'], color); 94 _addClass(classId, member['name'], color);
95 } 95 }
96 _addClass(freeClassId, 'Free', _freeColor); 96 _addClass(freeClassId, 'Free', _freeColor);
97 _addClass(0, '', _pageSeparationColor); 97 _addClass(0, '', _pageSeparationColor);
98 } 98 }
99 99
100 Iterable<int> _classIdToRGBA(int classId) { 100 Iterable<int> _classIdToRGBA(int classId) {
101 // TODO(koda): Pick random hue, but fixed saturation and value. 101 // TODO(koda): Pick random hue, but fixed saturation and value.
102 var rng = new Random(classId); 102 var rng = new Random(classId);
103 return [rng.nextInt(128), rng.nextInt(128), rng.nextInt(128), 255]; 103 return [rng.nextInt(128), rng.nextInt(128), rng.nextInt(128), 255];
104 } 104 }
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 }).whenComplete(done); 193 }).whenComplete(done);
194 } 194 }
195 195
196 void fragmentationChanged(oldValue) { 196 void fragmentationChanged(oldValue) {
197 // Async, in case enteredView has not yet run (observed in JS version). 197 // Async, in case enteredView has not yet run (observed in JS version).
198 new Future(() { 198 new Future(() {
199 _updateFragmentationData(); 199 _updateFragmentationData();
200 }); 200 });
201 } 201 }
202 } 202 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698