| OLD | NEW |
| 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 return packed; | 89 return packed; |
| 90 } | 90 } |
| 91 | 91 |
| 92 void _addClass(int classId, String name, Iterable<int> color) { | 92 void _addClass(int classId, String name, Iterable<int> color) { |
| 93 _classIdToName[classId] = name.split('@')[0]; | 93 _classIdToName[classId] = name.split('@')[0]; |
| 94 _classIdToColor[classId] = color; | 94 _classIdToColor[classId] = color; |
| 95 _colorToClassId[_packColor(color)] = classId; | 95 _colorToClassId[_packColor(color)] = classId; |
| 96 } | 96 } |
| 97 | 97 |
| 98 void _updateClassList(classList, int freeClassId) { | 98 void _updateClassList(classList, int freeClassId) { |
| 99 for (var member in classList['members']) { | 99 for (var member in classList['classes']) { |
| 100 if (member is! Class) { | 100 if (member is! Class) { |
| 101 // TODO(turnidge): The printing for some of these non-class | 101 // TODO(turnidge): The printing for some of these non-class |
| 102 // members is broken. Fix this: | 102 // members is broken. Fix this: |
| 103 // | 103 // |
| 104 // Logger.root.info('$member'); | 104 // Logger.root.info('$member'); |
| 105 Logger.root.info('Ignoring non-class in class list'); | 105 Logger.root.info('Ignoring non-class in class list'); |
| 106 continue; | 106 continue; |
| 107 } | 107 } |
| 108 var classId = int.parse(member.id.split('/').last); | 108 var classId = int.parse(member.id.split('/').last); |
| 109 var color = _classIdToRGBA(classId); | 109 var color = _classIdToRGBA(classId); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 | 153 |
| 154 void _handleMouseMove(MouseEvent event) { | 154 void _handleMouseMove(MouseEvent event) { |
| 155 var info = _objectAt(event.offset); | 155 var info = _objectAt(event.offset); |
| 156 var addressString = '${info.size}B @ 0x${info.address.toRadixString(16)}'; | 156 var addressString = '${info.size}B @ 0x${info.address.toRadixString(16)}'; |
| 157 var className = _classNameAt(event.offset); | 157 var className = _classNameAt(event.offset); |
| 158 status = (className == '') ? '-' : '$className $addressString'; | 158 status = (className == '') ? '-' : '$className $addressString'; |
| 159 } | 159 } |
| 160 | 160 |
| 161 void _handleClick(MouseEvent event) { | 161 void _handleClick(MouseEvent event) { |
| 162 var address = _objectAt(event.offset).address.toRadixString(16); | 162 var address = _objectAt(event.offset).address.toRadixString(16); |
| 163 app.locationManager.go(app.locationManager.makeLink( | 163 isolate.getObjectByAddress(address).then((result) { |
| 164 "${isolate.relativeLink('address/$address')}")); | 164 if (result is DartError) { |
| 165 Logger.root.severe(result.message); |
| 166 } else { |
| 167 app.locationManager.go(gotoLink('/inspect', result)); |
| 168 } |
| 169 }); |
| 165 } | 170 } |
| 166 | 171 |
| 167 void _updateFragmentationData() { | 172 void _updateFragmentationData() { |
| 168 if (fragmentation == null || _fragmentationCanvas == null) { | 173 if (fragmentation == null || _fragmentationCanvas == null) { |
| 169 return; | 174 return; |
| 170 } | 175 } |
| 171 _updateClassList( | 176 _updateClassList( |
| 172 fragmentation['class_list'], fragmentation['free_class_id']); | 177 fragmentation['class_list'], fragmentation['free_class_id']); |
| 173 var pages = fragmentation['pages']; | 178 var pages = fragmentation['pages']; |
| 174 var width = _fragmentationCanvas.parent.client.width; | 179 var width = _fragmentationCanvas.parent.client.width; |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 }).whenComplete(done); | 246 }).whenComplete(done); |
| 242 } | 247 } |
| 243 | 248 |
| 244 void fragmentationChanged(oldValue) { | 249 void fragmentationChanged(oldValue) { |
| 245 // Async, in case attached has not yet run (observed in JS version). | 250 // Async, in case attached has not yet run (observed in JS version). |
| 246 new Future(() { | 251 new Future(() { |
| 247 _updateFragmentationData(); | 252 _updateFragmentationData(); |
| 248 }); | 253 }); |
| 249 } | 254 } |
| 250 } | 255 } |
| OLD | NEW |