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

Unified Diff: runtime/lib/isolate_patch.dart

Issue 88783002: Isolate.spawn{Uri} only reports errors asynchronously. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 7 years 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 | runtime/lib/print_patch.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/isolate_patch.dart
diff --git a/runtime/lib/isolate_patch.dart b/runtime/lib/isolate_patch.dart
index 3792a5b4d2ddbdee1d72446d80c67cae5cd82062..7d185beb17b9c3c9ef317d235d68cde73cb59718 100644
--- a/runtime/lib/isolate_patch.dart
+++ b/runtime/lib/isolate_patch.dart
@@ -229,40 +229,39 @@ void _startIsolate(Function entryPoint, bool isSpawnUri) {
patch class Isolate {
/* patch */ static Future<Isolate> spawn(
void entryPoint(message), var message) {
- Completer completer = new Completer<Isolate>.sync();
try {
// The VM will invoke [_startIsolate] with entryPoint as argument.
SendPort controlPort = _spawnFunction(entryPoint);
RawReceivePort readyPort = new RawReceivePort();
controlPort.send([readyPort.sendPort, message]);
+ Completer completer = new Completer<Isolate>.sync();
readyPort.handler = (readyMessage) {
assert(readyMessage == 'started');
readyPort.close();
completer.complete(new Isolate._fromControlPort(controlPort));
};
- } catch(e, st) {
- // TODO(14718): we want errors to go into the returned future.
- rethrow;
+ return completer.future;
+ } catch (e, st) {
+ return new Future<Isolate>.error(e, st);
};
- return completer.future;
}
/* patch */ static Future<Isolate> spawnUri(
Uri uri, List<String> args, var message) {
- Completer completer = new Completer<Isolate>.sync();
try {
// The VM will invoke [_startIsolate] and not `main`.
SendPort controlPort = _spawnUri(uri.toString());
RawReceivePort readyPort = new RawReceivePort();
controlPort.send([readyPort.sendPort, args, message]);
+ Completer completer = new Completer<Isolate>.sync();
readyPort.handler = (readyMessage) {
assert(readyMessage == 'started');
readyPort.close();
completer.complete(new Isolate._fromControlPort(controlPort));
};
- } catch(e, st) {
- // TODO(14718): we want errors to go into the returned future.
- rethrow;
+ return completer.future;
+ } catch (e, st) {
+ return new Future<Isolate>.error(e, st);
};
return completer.future;
}
« no previous file with comments | « no previous file | runtime/lib/print_patch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698