| Index: sdk/lib/_internal/lib/isolate_patch.dart
|
| diff --git a/sdk/lib/_internal/lib/isolate_patch.dart b/sdk/lib/_internal/lib/isolate_patch.dart
|
| index 8ad378569618eb3dd922e5f140e5eb57a35d47bb..b1dd542db17a8592eec3cf562b2bacb20e56a32a 100644
|
| --- a/sdk/lib/_internal/lib/isolate_patch.dart
|
| +++ b/sdk/lib/_internal/lib/isolate_patch.dart
|
| @@ -12,35 +12,23 @@ import 'dart:_isolate_helper' show IsolateNatives,
|
|
|
| patch class Isolate {
|
| patch static Future<Isolate> spawn(void entryPoint(message), var message) {
|
| - throw new UnimplementedError("spawn");
|
| + SendPort controlPort = IsolateNatives.spawnFunction(entryPoint, message);
|
| + return new Future<Isolate>.value(new Isolate._fromControlPort(controlPort));
|
| }
|
|
|
| patch static Future<Isolate> spawnUri(
|
| Uri uri, List<String> args, var message) {
|
| - throw new UnimplementedError("spawn uri");
|
| - }
|
| -}
|
| -
|
| -class _Isolate {
|
| - static ReceivePort get port {
|
| - if (lazyPort == null) {
|
| - lazyPort = new ReceivePort();
|
| + if (args is List<String>) {
|
| + for (int i = 0; i < args.length; i++) {
|
| + if (args[i] is! String) {
|
| + throw new ArgumentError("Args must be a list of Strings $args");
|
| + }
|
| + }
|
| + } else if (args != null) {
|
| + throw new ArgumentError("Args must be a list of Strings $args");
|
| }
|
| - return lazyPort;
|
| - }
|
| -
|
| - static SendPort _spawnFunction(void topLevelFunction(),
|
| - [bool unhandledExceptionCallback(IsolateUnhandledException e)]) {
|
| - if (unhandledExceptionCallback != null) {
|
| - // TODO(9012): Implement the UnhandledExceptionCallback.
|
| - throw new UnimplementedError(
|
| - "spawnFunction with unhandledExceptionCallback");
|
| - }
|
| - return IsolateNatives.spawnFunction(topLevelFunction);
|
| - }
|
| -
|
| - static SendPort _spawnUri(String uri) {
|
| - return IsolateNatives.spawn(null, uri, false);
|
| + SendPort controlPort = IsolateNatives.spawn(uri, args, message);
|
| + return new Future<Isolate>.value(new Isolate._fromControlPort(controlPort));
|
| }
|
| }
|
|
|
| @@ -59,4 +47,4 @@ patch class RawReceivePort {
|
| patch factory RawReceivePort([void handler(event)]) {
|
| throw new UnimplementedError("RawReceivePort");
|
| }
|
| -}
|
| +}
|
|
|