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

Unified Diff: runtime/lib/isolate_patch.dart

Issue 507913003: Create isolates in a separate thread. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 4 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/lib/isolate_patch.dart
diff --git a/runtime/lib/isolate_patch.dart b/runtime/lib/isolate_patch.dart
index 39826f656a469ed179aab3353180142ac6db3dd9..ffd2b587eec279463bff895a55f15a55265d8de1 100644
--- a/runtime/lib/isolate_patch.dart
+++ b/runtime/lib/isolate_patch.dart
@@ -256,13 +256,19 @@ patch class Isolate {
Completer completer = new Completer<Isolate>.sync();
readyPort.handler = (readyMessage) {
readyPort.close();
- assert(readyMessage is List);
- assert(readyMessage.length == 2);
- SendPort controlPort = readyMessage[0];
- List capabilities = readyMessage[1];
- completer.complete(new Isolate(controlPort,
- pauseCapability: capabilities[0],
- terminateCapability: capabilities[1]));
+ if (readyMessage is String) {
+ // We encountered an error starting the new isolate.
+ completer.completeError(new IsolateSpawnException(
+ "Unable to spawn child isolate:\n${readyMessage}"));
+ } else {
+ assert(readyMessage is List);
Cutch 2014/08/27 18:18:43 These asserts will only trigger in checked mode. S
turnidge 2014/08/27 19:28:59 Done. On 2014/08/27 18:18:43, Cutch wrote:
+ assert(readyMessage.length == 2);
+ SendPort controlPort = readyMessage[0];
+ List capabilities = readyMessage[1];
+ completer.complete(new Isolate(controlPort,
+ pauseCapability: capabilities[0],
+ terminateCapability: capabilities[1]));
+ }
};
return completer.future;
} catch (e, st) {
@@ -284,13 +290,19 @@ patch class Isolate {
Completer completer = new Completer<Isolate>.sync();
readyPort.handler = (readyMessage) {
readyPort.close();
- assert(readyMessage is List);
- assert(readyMessage.length == 2);
- SendPort controlPort = readyMessage[0];
- List capabilities = readyMessage[1];
- completer.complete(new Isolate(controlPort,
- pauseCapability: capabilities[0],
- terminateCapability: capabilities[1]));
+ if (readyMessage is String) {
+ // We encountered an error starting the new isolate.
+ completer.completeError(new IsolateSpawnException(
+ "Unable to spawn child isolate:\n${readyMessage}"));
+ } else {
+ assert(readyMessage is List);
+ assert(readyMessage.length == 2);
+ SendPort controlPort = readyMessage[0];
+ List capabilities = readyMessage[1];
+ completer.complete(new Isolate(controlPort,
Cutch 2014/08/27 18:18:43 Duplicate code from above? Perhaps you can extract
turnidge 2014/08/27 19:28:59 Extracted common code into new function spawnCommo
+ pauseCapability: capabilities[0],
+ terminateCapability: capabilities[1]));
+ }
};
return completer.future;
} catch (e, st) {
« runtime/lib/isolate.cc ('K') | « runtime/lib/isolate.cc ('k') | runtime/vm/isolate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698