| 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 import "dart:collection" show HashMap; | 5 import "dart:collection" show HashMap; |
| 6 | 6 |
| 7 patch class ReceivePort { | 7 patch class ReceivePort { |
| 8 /* patch */ factory ReceivePort() = _ReceivePortImpl; | 8 /* patch */ factory ReceivePort() = _ReceivePortImpl; |
| 9 | 9 |
| 10 /* patch */ factory ReceivePort.fromRawReceivePort(RawReceivePort rawPort) = | 10 /* patch */ factory ReceivePort.fromRawReceivePort(RawReceivePort rawPort) = |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 return completer.future; | 267 return completer.future; |
| 268 } catch (e, st) { | 268 } catch (e, st) { |
| 269 if (readyPort != null) { | 269 if (readyPort != null) { |
| 270 readyPort.close(); | 270 readyPort.close(); |
| 271 } | 271 } |
| 272 return new Future<Isolate>.error(e, st); | 272 return new Future<Isolate>.error(e, st); |
| 273 }; | 273 }; |
| 274 } | 274 } |
| 275 | 275 |
| 276 /* patch */ static Future<Isolate> spawnUri( | 276 /* patch */ static Future<Isolate> spawnUri( |
| 277 Uri uri, List<String> args, var message, { bool paused: false }) { | 277 Uri uri, List<String> args, var message, |
| 278 { bool paused: false, Uri packageRoot }) { |
| 278 // `paused` isn't handled yet. | 279 // `paused` isn't handled yet. |
| 280 // `packageRoot` isn't handled yet. |
| 281 if (packageRoot != null) throw new UnimplementedError("packageRoot"); |
| 279 RawReceivePort readyPort; | 282 RawReceivePort readyPort; |
| 280 try { | 283 try { |
| 281 // The VM will invoke [_startIsolate] and not `main`. | 284 // The VM will invoke [_startIsolate] and not `main`. |
| 282 readyPort = new RawReceivePort(); | 285 readyPort = new RawReceivePort(); |
| 283 _spawnUri(readyPort.sendPort, uri.toString(), args, message); | 286 _spawnUri(readyPort.sendPort, uri.toString(), args, message); |
| 284 Completer completer = new Completer<Isolate>.sync(); | 287 Completer completer = new Completer<Isolate>.sync(); |
| 285 readyPort.handler = (readyMessage) { | 288 readyPort.handler = (readyMessage) { |
| 286 readyPort.close(); | 289 readyPort.close(); |
| 287 assert(readyMessage is List); | 290 assert(readyMessage is List); |
| 288 assert(readyMessage.length == 2); | 291 assert(readyMessage.length == 2); |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 } | 360 } |
| 358 | 361 |
| 359 /* patch */ void addErrorListener(SendPort port) { | 362 /* patch */ void addErrorListener(SendPort port) { |
| 360 throw new UnsupportedError("addErrorListener"); | 363 throw new UnsupportedError("addErrorListener"); |
| 361 } | 364 } |
| 362 | 365 |
| 363 /* patch */ void removeErrorListener(SendPort port) { | 366 /* patch */ void removeErrorListener(SendPort port) { |
| 364 throw new UnsupportedError("removeErrorListener"); | 367 throw new UnsupportedError("removeErrorListener"); |
| 365 } | 368 } |
| 366 } | 369 } |
| OLD | NEW |