| OLD | NEW |
| 1 // Copyright (c) 2011, 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 class _ReceivePortFactory { | 5 class _ReceivePortFactory { |
| 6 factory ReceivePort() { | 6 factory ReceivePort() { |
| 7 return new _ReceivePortImpl(); | 7 return new _ReceivePortImpl(); |
| 8 } | 8 } |
| 9 } | 9 } |
| 10 | 10 |
| 11 | 11 |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 } | 107 } |
| 108 | 108 |
| 109 // Forward the implementation of sending messages to the VM. Only port ids | 109 // Forward the implementation of sending messages to the VM. Only port ids |
| 110 // are being handed to the VM. | 110 // are being handed to the VM. |
| 111 static _sendInternal(int sendId, int replyId, var message) | 111 static _sendInternal(int sendId, int replyId, var message) |
| 112 native "SendPortImpl_sendInternal_"; | 112 native "SendPortImpl_sendInternal_"; |
| 113 | 113 |
| 114 final int _id; | 114 final int _id; |
| 115 } | 115 } |
| 116 | 116 |
| 117 class _IsolateNatives { | |
| 118 static Future<SendPort> spawn(Isolate isolate, bool isLight) { | |
| 119 Completer<SendPort> completer = new Completer<SendPort>(); | |
| 120 SendPort port = _start(isolate, isLight); | |
| 121 completer.complete(port); | |
| 122 return completer.future; | |
| 123 } | |
| 124 | |
| 125 // Starts a new isolate calling the run method on a new instance of the | |
| 126 // remote class's type. | |
| 127 // Returns the send port which is passed to the newly created isolate. | |
| 128 // This method is being dispatched to from the public core library code. | |
| 129 static SendPort _start(Isolate isolate, bool light) | |
| 130 native "IsolateNatives_start"; | |
| 131 } | |
| 132 | |
| 133 _getPortInternal() native "isolate_getPortInternal"; | 117 _getPortInternal() native "isolate_getPortInternal"; |
| 134 | 118 |
| 135 ReceivePort _portInternal; | 119 ReceivePort _portInternal; |
| 136 | 120 |
| 137 ReceivePort get _port() { | 121 ReceivePort get _port() { |
| 138 if (_portInternal === null) { | 122 if (_portInternal === null) { |
| 139 _portInternal = _getPortInternal(); | 123 _portInternal = _getPortInternal(); |
| 140 } | 124 } |
| 141 return _portInternal; | 125 return _portInternal; |
| 142 } | 126 } |
| 143 | 127 |
| 144 _spawnFunction(void topLevelFunction()) native "isolate_spawnFunction"; | 128 _spawnFunction(void topLevelFunction()) native "isolate_spawnFunction"; |
| 145 | 129 |
| 146 _spawnUri(String uri) native "isolate_spawnUri"; | 130 _spawnUri(String uri) native "isolate_spawnUri"; |
| OLD | NEW |