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

Side by Side Diff: runtime/observatory/lib/src/elements/heap_map.dart

Issue 1120133002: Rework error handling in the service protocol and in Observatory. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: fix tests Created 5 years, 7 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
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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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 }
OLDNEW
« no previous file with comments | « runtime/observatory/lib/src/elements/function_view.dart ('k') | runtime/observatory/lib/src/elements/heap_profile.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698