| 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 class ReceivePort { | 5 patch class ReceivePort { |
| 6 /* patch */ factory ReceivePort() = _ReceivePortImpl; | 6 /* patch */ factory ReceivePort() = _ReceivePortImpl; |
| 7 | 7 |
| 8 /* patch */ factory ReceivePort.fromRawReceivePort(RawReceivePort rawPort) = | 8 /* patch */ factory ReceivePort.fromRawReceivePort(RawReceivePort rawPort) = |
| 9 _ReceivePortImpl.fromRawReceivePort; | 9 _ReceivePortImpl.fromRawReceivePort; |
| 10 } | 10 } |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 rethrow; | 206 rethrow; |
| 207 }; | 207 }; |
| 208 return completer.future; | 208 return completer.future; |
| 209 } | 209 } |
| 210 | 210 |
| 211 /* patch */ static Future<Isolate> spawnUri( | 211 /* patch */ static Future<Isolate> spawnUri( |
| 212 Uri uri, List<String> args, var message) { | 212 Uri uri, List<String> args, var message) { |
| 213 Completer completer = new Completer<Isolate>.sync(); | 213 Completer completer = new Completer<Isolate>.sync(); |
| 214 try { | 214 try { |
| 215 // The VM will invoke [_startIsolate] and not `main`. | 215 // The VM will invoke [_startIsolate] and not `main`. |
| 216 SendPort controlPort = _spawnUri(uri.path); | 216 SendPort controlPort = _spawnUri(uri.toString()); |
| 217 RawReceivePort readyPort = new RawReceivePort(); | 217 RawReceivePort readyPort = new RawReceivePort(); |
| 218 controlPort.send([readyPort.sendPort, args, message]); | 218 controlPort.send([readyPort.sendPort, args, message]); |
| 219 readyPort.handler = (readyMessage) { | 219 readyPort.handler = (readyMessage) { |
| 220 assert(readyMessage == 'started'); | 220 assert(readyMessage == 'started'); |
| 221 readyPort.close(); | 221 readyPort.close(); |
| 222 completer.complete(new Isolate._fromControlPort(controlPort)); | 222 completer.complete(new Isolate._fromControlPort(controlPort)); |
| 223 }; | 223 }; |
| 224 } catch(e, st) { | 224 } catch(e, st) { |
| 225 // TODO(floitsch): we want errors to go into the returned future. | 225 // TODO(floitsch): we want errors to go into the returned future. |
| 226 rethrow; | 226 rethrow; |
| 227 }; | 227 }; |
| 228 return completer.future; | 228 return completer.future; |
| 229 } | 229 } |
| 230 | 230 |
| 231 static final ReceivePort _port = | 231 static final ReceivePort _port = |
| 232 new ReceivePort.fromRawReceivePort(_getPortInternal()); | 232 new ReceivePort.fromRawReceivePort(_getPortInternal()); |
| 233 | 233 |
| 234 static SendPort _spawnFunction(Function topLevelFunction) | 234 static SendPort _spawnFunction(Function topLevelFunction) |
| 235 native "isolate_spawnFunction"; | 235 native "isolate_spawnFunction"; |
| 236 | 236 |
| 237 static SendPort _spawnUri(String uri) native "isolate_spawnUri"; | 237 static SendPort _spawnUri(String uri) native "isolate_spawnUri"; |
| 238 } | 238 } |
| OLD | NEW |