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

Unified Diff: runtime/observatory/lib/src/elements/heap_profile.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 side-by-side diff with in-line comments
Download patch
Index: runtime/observatory/lib/src/elements/heap_profile.dart
diff --git a/runtime/observatory/lib/src/elements/heap_profile.dart b/runtime/observatory/lib/src/elements/heap_profile.dart
index bac6ba7ce40bffdadac43986d31eef65e9d2b7fd..5e097e5e7a0d5606f021059ca333691a3d9b1013 100644
--- a/runtime/observatory/lib/src/elements/heap_profile.dart
+++ b/runtime/observatory/lib/src/elements/heap_profile.dart
@@ -4,6 +4,7 @@
library heap_profile_element;
+import 'dart:async';
import 'dart:html';
import 'observatory_element.dart';
import 'package:observatory/app.dart';
@@ -99,7 +100,7 @@ class HeapProfileElement extends ObservatoryElement {
@override
void detached() {
- _subscription.cancel((){});
+ _subscription.cancel();
super.detached();
}
@@ -121,13 +122,13 @@ class HeapProfileElement extends ObservatoryElement {
void refreshAuto() {
refreshAutoPending = true;
refreshAutoQueued = false;
- refresh(() {
+ refresh().then((_) {
refreshAutoPending = false;
// Keep refreshing if at least one GC event was received while waiting.
if (refreshAutoQueued) {
refreshAuto();
}
- });
+ }).catchError(app.handleException);
}
void _updatePieCharts() {
@@ -284,31 +285,33 @@ class HeapProfileElement extends ObservatoryElement {
profile = null;
return;
}
- isolate.invokeRpc('_getAllocationProfile', {}).then(_update);
+ isolate.invokeRpc('_getAllocationProfile', {})
+ .then(_update)
+ .catchError(app.handleException);
}
- void refresh(var done) {
+ Future refresh() {
if (isolate == null) {
- return;
+ return new Future.value(null);
}
- isolate.invokeRpc('_getAllocationProfile', {})
- .then(_update).whenComplete(done);
+ return isolate.invokeRpc('_getAllocationProfile', {})
+ .then(_update);
}
- void refreshGC(var done) {
+ Future refreshGC() {
if (isolate == null) {
- return;
+ return new Future.value(null);
}
- isolate.invokeRpc('_getAllocationProfile', { 'gc': 'full' })
- .then(_update).whenComplete(done);
+ return isolate.invokeRpc('_getAllocationProfile', { 'gc': 'full' })
+ .then(_update);
}
- void resetAccumulator(var done) {
+ Future resetAccumulator() {
if (isolate == null) {
- return;
+ return new Future.value(null);
}
- isolate.invokeRpc('_getAllocationProfile', { 'reset': 'true' })
- .then(_update).whenComplete(done);
+ return isolate.invokeRpc('_getAllocationProfile', { 'reset': 'true' })
+ .then(_update);
}
void _update(ServiceMap newProfile) {
« no previous file with comments | « runtime/observatory/lib/src/elements/heap_map.dart ('k') | runtime/observatory/lib/src/elements/instance_ref.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698