| 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 'package:observatory/models.dart' as M; | 10 import 'package:observatory/models.dart' as M; |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 | 101 |
| 102 // Set hover text to describe the object under the cursor. | 102 // Set hover text to describe the object under the cursor. |
| 103 _canvas.title = _status; | 103 _canvas.title = _status; |
| 104 | 104 |
| 105 children = [ | 105 children = [ |
| 106 navBar([ | 106 navBar([ |
| 107 new NavTopMenuElement(queue: _r.queue), | 107 new NavTopMenuElement(queue: _r.queue), |
| 108 new NavVMMenuElement(_vm, _events, queue: _r.queue), | 108 new NavVMMenuElement(_vm, _events, queue: _r.queue), |
| 109 new NavIsolateMenuElement(_isolate, _events, queue: _r.queue), | 109 new NavIsolateMenuElement(_isolate, _events, queue: _r.queue), |
| 110 navMenu('heap map'), | 110 navMenu('heap map'), |
| 111 new NavRefreshElement(label: 'GC', queue: _r.queue) |
| 112 ..onRefresh.listen((_) => _refresh(gc: true)), |
| 111 new NavRefreshElement(queue: _r.queue) | 113 new NavRefreshElement(queue: _r.queue) |
| 112 ..onRefresh.listen((_) => _refresh()), | 114 ..onRefresh.listen((_) => _refresh()), |
| 113 new NavNotifyElement(_notifications, queue: _r.queue) | 115 new NavNotifyElement(_notifications, queue: _r.queue) |
| 114 ]), | 116 ]), |
| 115 new DivElement() | 117 new DivElement() |
| 116 ..classes = ['content-centered-big'] | 118 ..classes = ['content-centered-big'] |
| 117 ..children = [ | 119 ..children = [ |
| 118 new HeadingElement.h2()..text = _status, | 120 new HeadingElement.h2()..text = _status, |
| 119 new HRElement(), | 121 new HRElement(), |
| 120 ], | 122 ], |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 pixel = pixel.next(); | 272 pixel = pixel.next(); |
| 271 } | 273 } |
| 272 _canvas.context2D.putImageData( | 274 _canvas.context2D.putImageData( |
| 273 _fragmentationData, 0, 0, 0, startY, _fragmentationData.width, endY); | 275 _fragmentationData, 0, 0, 0, startY, _fragmentationData.width, endY); |
| 274 // Continue with the next page, asynchronously. | 276 // Continue with the next page, asynchronously. |
| 275 new Future(() { | 277 new Future(() { |
| 276 _renderPages(startPage + 1); | 278 _renderPages(startPage + 1); |
| 277 }); | 279 }); |
| 278 } | 280 } |
| 279 | 281 |
| 280 Future _refresh() { | 282 Future _refresh({gc: false}) { |
| 281 final isolate = _isolate as S.Isolate; | 283 final isolate = _isolate as S.Isolate; |
| 282 return isolate.invokeRpc('_getHeapMap', {}).then((S.ServiceMap response) { | 284 var params = {}; |
| 285 if (gc) { |
| 286 params['gc'] = 'full'; |
| 287 } |
| 288 return isolate |
| 289 .invokeRpc('_getHeapMap', params) |
| 290 .then((S.ServiceMap response) { |
| 283 assert(response['type'] == 'HeapMap'); | 291 assert(response['type'] == 'HeapMap'); |
| 284 _fragmentation = response; | 292 _fragmentation = response; |
| 285 _updateFragmentationData(); | 293 _updateFragmentationData(); |
| 286 }); | 294 }); |
| 287 } | 295 } |
| 288 } | 296 } |
| 289 | 297 |
| 290 // A reference to a particular pixel of ImageData. | 298 // A reference to a particular pixel of ImageData. |
| 291 class PixelReference { | 299 class PixelReference { |
| 292 final _data; | 300 final _data; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 314 | 322 |
| 315 // The row-major index of this pixel. | 323 // The row-major index of this pixel. |
| 316 int get index => _dataIndex ~/ NUM_COLOR_COMPONENTS; | 324 int get index => _dataIndex ~/ NUM_COLOR_COMPONENTS; |
| 317 } | 325 } |
| 318 | 326 |
| 319 class ObjectInfo { | 327 class ObjectInfo { |
| 320 final address; | 328 final address; |
| 321 final size; | 329 final size; |
| 322 ObjectInfo(this.address, this.size); | 330 ObjectInfo(this.address, this.size); |
| 323 } | 331 } |
| OLD | NEW |