| 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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 isolate.getObjectByAddress(address).then((result) { | 163 isolate.getObjectByAddress(address).then((result) { |
| 164 if (result is DartError) { | 164 if (result.type != 'Sentinel') { |
| 165 Logger.root.severe(result.message); | |
| 166 } else if (result.type != 'Sentinel') { | |
| 167 app.locationManager.go(gotoLink('/inspect', result)); | 165 app.locationManager.go(gotoLink('/inspect', result)); |
| 168 } | 166 } |
| 169 }); | 167 }); |
| 170 } | 168 } |
| 171 | 169 |
| 172 void _updateFragmentationData() { | 170 void _updateFragmentationData() { |
| 173 if (fragmentation == null || _fragmentationCanvas == null) { | 171 if (fragmentation == null || _fragmentationCanvas == null) { |
| 174 return; | 172 return; |
| 175 } | 173 } |
| 176 _updateClassList( | 174 _updateClassList( |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 return; | 225 return; |
| 228 } | 226 } |
| 229 isolate.invokeRpc('getHeapMap', {}).then((ServiceMap response) { | 227 isolate.invokeRpc('getHeapMap', {}).then((ServiceMap response) { |
| 230 assert(response['type'] == 'HeapMap'); | 228 assert(response['type'] == 'HeapMap'); |
| 231 fragmentation = response; | 229 fragmentation = response; |
| 232 }).catchError((e, st) { | 230 }).catchError((e, st) { |
| 233 Logger.root.info('$e $st'); | 231 Logger.root.info('$e $st'); |
| 234 }); | 232 }); |
| 235 } | 233 } |
| 236 | 234 |
| 237 void refresh(var done) { | 235 Future refresh() { |
| 238 if (isolate == null) { | 236 if (isolate == null) { |
| 239 return; | 237 return new Future.value(null); |
| 240 } | 238 } |
| 241 isolate.invokeRpc('getHeapMap', {}).then((ServiceMap response) { | 239 return isolate.invokeRpc('getHeapMap', {}).then((ServiceMap response) { |
| 242 assert(response['type'] == 'HeapMap'); | 240 assert(response['type'] == 'HeapMap'); |
| 243 fragmentation = response; | 241 fragmentation = response; |
| 244 }).catchError((e, st) { | 242 }); |
| 245 Logger.root.info('$e $st'); | |
| 246 }).whenComplete(done); | |
| 247 } | 243 } |
| 248 | 244 |
| 249 void fragmentationChanged(oldValue) { | 245 void fragmentationChanged(oldValue) { |
| 250 // Async, in case attached has not yet run (observed in JS version). | 246 // Async, in case attached has not yet run (observed in JS version). |
| 251 new Future(() { | 247 new Future(() { |
| 252 _updateFragmentationData(); | 248 _updateFragmentationData(); |
| 253 }); | 249 }); |
| 254 } | 250 } |
| 255 } | 251 } |
| OLD | NEW |