| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 // Patch file for the dart:isolate library. | 5 // Patch file for the dart:isolate library. |
| 6 | 6 |
| 7 import 'dart:_js_helper' show patch; | 7 import 'dart:_js_helper' show patch; |
| 8 import 'dart:_isolate_helper' show CapabilityImpl, | 8 import 'dart:_isolate_helper' show CapabilityImpl, |
| 9 CloseToken, | 9 CloseToken, |
| 10 IsolateNatives, | 10 IsolateNatives, |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 return isolate; | 55 return isolate; |
| 56 }); | 56 }); |
| 57 } catch (e, st) { | 57 } catch (e, st) { |
| 58 return new Future<Isolate>.error(e, st); | 58 return new Future<Isolate>.error(e, st); |
| 59 } | 59 } |
| 60 } | 60 } |
| 61 | 61 |
| 62 @patch | 62 @patch |
| 63 static Future<Isolate> spawnUri( | 63 static Future<Isolate> spawnUri( |
| 64 Uri uri, List<String> args, var message, | 64 Uri uri, List<String> args, var message, |
| 65 {bool paused: false, bool checked, Uri packageRoot, bool errorsAreFatal, | 65 {bool paused: false, |
| 66 SendPort onExit, SendPort onError}) { | 66 bool checked, |
| 67 Uri packageRoot, |
| 68 Map<String, Uri> packages, |
| 69 bool errorsAreFatal, |
| 70 SendPort onExit, |
| 71 SendPort onError}) { |
| 67 if (packageRoot != null) throw new UnimplementedError("packageRoot"); | 72 if (packageRoot != null) throw new UnimplementedError("packageRoot"); |
| 73 if (packages != null) throw new UnimplementedError("packages"); |
| 68 bool forcePause = (errorsAreFatal != null) || | 74 bool forcePause = (errorsAreFatal != null) || |
| 69 (onExit != null) || | 75 (onExit != null) || |
| 70 (onError != null); | 76 (onError != null); |
| 71 try { | 77 try { |
| 72 if (args is List<String>) { | 78 if (args is List<String>) { |
| 73 for (int i = 0; i < args.length; i++) { | 79 for (int i = 0; i < args.length; i++) { |
| 74 if (args[i] is! String) { | 80 if (args[i] is! String) { |
| 75 throw new ArgumentError("Args must be a list of Strings $args"); | 81 throw new ArgumentError("Args must be a list of Strings $args"); |
| 76 } | 82 } |
| 77 } | 83 } |
| 78 } else if (args != null) { | 84 } else if (args != null) { |
| 79 throw new ArgumentError("Args must be a list of Strings $args"); | 85 throw new ArgumentError("Args must be a list of Strings $args"); |
| 80 } | 86 } |
| 87 // TODO: Handle [packageRoot]/[packages] somehow, possibly by throwing. |
| 81 // TODO: Consider passing the errorsAreFatal/onExit/onError values | 88 // TODO: Consider passing the errorsAreFatal/onExit/onError values |
| 82 // as arguments to the internal spawnUri instead of setting | 89 // as arguments to the internal spawnUri instead of setting |
| 83 // them after the isolate has been created. | 90 // them after the isolate has been created. |
| 84 return IsolateNatives.spawnUri(uri, args, message, paused || forcePause) | 91 return IsolateNatives.spawnUri(uri, args, message, paused || forcePause) |
| 85 .then((msg) { | 92 .then((msg) { |
| 86 var isolate = new Isolate(msg[1], | 93 var isolate = new Isolate(msg[1], |
| 87 pauseCapability: msg[2], | 94 pauseCapability: msg[2], |
| 88 terminateCapability: msg[3]); | 95 terminateCapability: msg[3]); |
| 89 if (forcePause) { | 96 if (forcePause) { |
| 90 if (errorsAreFatal != null) { | 97 if (errorsAreFatal != null) { |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 factory RawReceivePort([void handler(event)]) { | 210 factory RawReceivePort([void handler(event)]) { |
| 204 return new RawReceivePortImpl(handler); | 211 return new RawReceivePortImpl(handler); |
| 205 } | 212 } |
| 206 } | 213 } |
| 207 | 214 |
| 208 @patch | 215 @patch |
| 209 class Capability { | 216 class Capability { |
| 210 @patch | 217 @patch |
| 211 factory Capability() = CapabilityImpl; | 218 factory Capability() = CapabilityImpl; |
| 212 } | 219 } |
| OLD | NEW |