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

Unified Diff: runtime/observatory/lib/src/service/object.dart

Issue 964703002: Make getIsolate ensure that the VM has been loaded before checking for the isolate (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 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/observatory/lib/src/service/object.dart
diff --git a/runtime/observatory/lib/src/service/object.dart b/runtime/observatory/lib/src/service/object.dart
index c6b1808af895929f1bcdf395cdad248a2a63492f..684931632eb754dd25883d9927e4617a9c707279 100644
--- a/runtime/observatory/lib/src/service/object.dart
+++ b/runtime/observatory/lib/src/service/object.dart
@@ -281,6 +281,11 @@ abstract class ServiceObject extends Observable {
// Updates internal state from [map]. [map] can be a reference.
void _update(ObservableMap map, bool mapIsRef);
+
+ // Helper that can be passed to .catchError that ignores the error.
+ _ignoreError(error, stackTrace) {
+ // do nothing.
+ }
}
abstract class Coverage {
@@ -505,6 +510,10 @@ abstract class VM extends ServiceObjectOwner {
// Note that this function does not reload the isolate if it found
// in the cache.
Future<ServiceObject> getIsolate(String isolateId) {
+ if (!loaded) {
+ // Trigger a VM load, then get the isolate.
+ return load().then((_) => getIsolate(isolateId)).catchError(_ignoreError);
+ }
return new Future.value(_isolateCache[isolateId]);
}
« 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