| Index: runtime/lib/isolate_patch.dart
|
| ===================================================================
|
| --- runtime/lib/isolate_patch.dart (revision 29315)
|
| +++ runtime/lib/isolate_patch.dart (working copy)
|
| @@ -151,6 +151,8 @@
|
| final int _id;
|
| }
|
|
|
| +_getPortInternal() native "isolate_getPortInternal";
|
| +
|
| typedef _MainFunction();
|
| typedef _MainFunctionArgs(args);
|
| typedef _MainFunctionArgsMessage(args, message);
|
| @@ -159,18 +161,10 @@
|
| * Takes the real entry point as argument and invokes it with the initial
|
| * message.
|
| *
|
| - * The initial message is received through the control port variable.
|
| + * The initial message is (currently) received through the global port variable.
|
| */
|
| void _startIsolate(Function entryPoint, bool isSpawnUri) {
|
| - ignoreHandler(message) {
|
| - // Messages on the current Isolate's control port are dropped after the
|
| - // initial startup message has been received.
|
| - }
|
| -
|
| - isolateStartHandler(message) {
|
| - // We received the initial startup message. Ignore all further messages.
|
| - Isolate._self.handler = ignoreHandler;
|
| -
|
| + Isolate._port.first.then((message) {
|
| SendPort replyTo = message[0];
|
| // TODO(floitsch): don't send ok-message if we can't find the entry point.
|
| replyTo.send("started");
|
| @@ -190,9 +184,7 @@
|
| var entryMessage = message[1];
|
| entryPoint(entryMessage);
|
| }
|
| - }
|
| -
|
| - Isolate._self.handler = isolateStartHandler;
|
| + });
|
| }
|
|
|
| patch class Isolate {
|
| @@ -236,11 +228,11 @@
|
| return completer.future;
|
| }
|
|
|
| - static final RawReceivePort _self = _mainPort;
|
| - static RawReceivePort get _mainPort native "Isolate_mainPort";
|
| + static final ReceivePort _port =
|
| + new ReceivePort.fromRawReceivePort(_getPortInternal());
|
|
|
| static SendPort _spawnFunction(Function topLevelFunction)
|
| - native "Isolate_spawnFunction";
|
| + native "isolate_spawnFunction";
|
|
|
| - static SendPort _spawnUri(String uri) native "Isolate_spawnUri";
|
| + static SendPort _spawnUri(String uri) native "isolate_spawnUri";
|
| }
|
|
|