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

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

Issue 330333004: Limit canvas height in heap map. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/vmservice/client/lib/src/elements/heap_map.dart
===================================================================
--- runtime/bin/vmservice/client/lib/src/elements/heap_map.dart (revision 37317)
+++ runtime/bin/vmservice/client/lib/src/elements/heap_map.dart (working copy)
@@ -61,6 +61,9 @@
static final _freeColor = [255, 255, 255, 255];
static final _pageSeparationColor = [0, 0, 0, 255];
static const _PAGE_SEPARATION_HEIGHT = 4;
+ // Many browsers will not display a very tall canvas.
+ // TODO(koda): Improve interface for huge heaps.
+ static const _MAX_CANVAS_HEIGHT = 6000;
@observable String status;
@published ServiceMap fragmentation;
@@ -165,7 +168,7 @@
_pageHeight = _PAGE_SEPARATION_HEIGHT +
fragmentation['page_size_bytes'] ~/
fragmentation['unit_size_bytes'] ~/ width;
- var height = _pageHeight * pages.length;
+ var height = min(_pageHeight * pages.length, _MAX_CANVAS_HEIGHT);
_fragmentationData =
_fragmentationCanvas.context2D.createImageData(width, height);
_fragmentationCanvas.width = _fragmentationData.width;
@@ -178,10 +181,11 @@
void _renderPages(int startPage) {
var pages = fragmentation['pages'];
status = 'Loaded $startPage of ${pages.length} pages';
- if (startPage >= pages.length) {
+ var startY = startPage * _pageHeight;
+ var endY = startY + _pageHeight;
+ if (startPage >= pages.length || endY > _fragmentationData.height) {
return;
}
- var startY = startPage * _pageHeight;
var pixel = new PixelReference(_fragmentationData, new Point(0, startY));
var objects = pages[startPage]['objects'];
for (var i = 0; i < objects.length; i += 2) {
@@ -193,7 +197,6 @@
pixel = pixel.next();
}
}
- var endY = startY + _pageHeight;
while (pixel.point.y < endY) {
pixel.color = _pageSeparationColor;
pixel = pixel.next();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698