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

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

Issue 249553003: Connect heap map to instance view. (Closed) Base URL: http://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
« no previous file with comments | « no previous file | runtime/vm/service.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 @observable String status; 59 @observable String status;
60 @published ServiceMap fragmentation; 60 @published ServiceMap fragmentation;
61 61
62 HeapMapElement.created() : super.created() { 62 HeapMapElement.created() : super.created() {
63 } 63 }
64 64
65 void enteredView() { 65 void enteredView() {
66 super.enteredView(); 66 super.enteredView();
67 _fragmentationCanvas = shadowRoot.querySelector("#fragmentation"); 67 _fragmentationCanvas = shadowRoot.querySelector("#fragmentation");
68 _fragmentationCanvas.onMouseMove.listen(_handleMouseMove); 68 _fragmentationCanvas.onMouseMove.listen(_handleMouseMove);
69 _fragmentationCanvas.onMouseDown.listen(_handleClick);
69 } 70 }
70 71
71 // Encode color as single integer, to enable using it as a map key. 72 // Encode color as single integer, to enable using it as a map key.
72 int _packColor(Iterable<int> color) { 73 int _packColor(Iterable<int> color) {
73 int packed = 0; 74 int packed = 0;
74 for (var component in color) { 75 for (var component in color) {
75 packed = packed * 256 + component; 76 packed = packed * 256 + component;
76 } 77 }
77 return packed; 78 return packed;
78 } 79 }
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 } else { 122 } else {
122 return 0; 123 return 0;
123 } 124 }
124 } 125 }
125 126
126 void _handleMouseMove(MouseEvent event) { 127 void _handleMouseMove(MouseEvent event) {
127 var addressString = '@ 0x${_addressAt(event.offset).toRadixString(16)}'; 128 var addressString = '@ 0x${_addressAt(event.offset).toRadixString(16)}';
128 var className = _classNameAt(event.offset); 129 var className = _classNameAt(event.offset);
129 status = (className == '') ? '-' : '$className $addressString'; 130 status = (className == '') ? '-' : '$className $addressString';
130 } 131 }
132
133 void _handleClick(MouseEvent event) {
134 var address = _addressAt(event.offset).toRadixString(16);
135 window.location.hash = "/${fragmentation.isolate.link}/address/$address";
136 }
131 137
132 void _updateFragmentationData() { 138 void _updateFragmentationData() {
133 if (fragmentation == null || _fragmentationCanvas == null) { 139 if (fragmentation == null || _fragmentationCanvas == null) {
134 return; 140 return;
135 } 141 }
136 _updateClassList( 142 _updateClassList(
137 fragmentation['class_list'], fragmentation['free_class_id']); 143 fragmentation['class_list'], fragmentation['free_class_id']);
138 var pages = fragmentation['pages']; 144 var pages = fragmentation['pages'];
139 var width = _fragmentationCanvas.parent.client.width; 145 var width = _fragmentationCanvas.parent.client.width;
140 _pageHeight = _PAGE_SEPARATION_HEIGHT + 146 _pageHeight = _PAGE_SEPARATION_HEIGHT +
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 }).whenComplete(done); 199 }).whenComplete(done);
194 } 200 }
195 201
196 void fragmentationChanged(oldValue) { 202 void fragmentationChanged(oldValue) {
197 // Async, in case enteredView has not yet run (observed in JS version). 203 // Async, in case enteredView has not yet run (observed in JS version).
198 new Future(() { 204 new Future(() {
199 _updateFragmentationData(); 205 _updateFragmentationData();
200 }); 206 });
201 } 207 }
202 } 208 }
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698