OLD | NEW |
---|---|
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 |
siva
2012/02/22 00:58:20
Ditto comment about moving this out of 'runtime'
Siggi Cherem (dart-lang)
2012/02/22 19:18:50
Done
| |
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 factory ReceivePort.singleShot() { | 10 factory ReceivePort.singleShot() { |
11 return new ReceivePortSingleShotImpl(); | 11 return new ReceivePortSingleShotImpl(); |
12 } | 12 } |
13 } | 13 } |
14 | 14 |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
133 | 133 |
134 // Forward the implementation of sending messages to the VM. Only port ids | 134 // Forward the implementation of sending messages to the VM. Only port ids |
135 // are being handed to the VM. | 135 // are being handed to the VM. |
136 static _sendInternal(int sendId, int replyId, var message) | 136 static _sendInternal(int sendId, int replyId, var message) |
137 native "SendPortImpl_sendInternal_"; | 137 native "SendPortImpl_sendInternal_"; |
138 | 138 |
139 final int _id; | 139 final int _id; |
140 } | 140 } |
141 | 141 |
142 | 142 |
143 class IsolateNatives { | |
144 static Future<SendPort> spawn(Isolate isolate, bool isLight) { | |
145 Completer<SendPort> completer = new Completer<SendPort>(); | |
146 SendPort port = _start(isolate, isLight); | |
147 completer.complete(port); | |
148 return completer.future; | |
149 } | |
150 | |
151 // Starts a new isolate calling the run method on a new instance of the | |
152 // remote class's type. | |
153 // Returns the send port which is passed to the newly created isolate. | |
154 // This method is being dispatched to from the public core library code. | |
155 static SendPort _start(Isolate isolate, bool light) | |
156 native "IsolateNatives_start"; | |
157 } | |
OLD | NEW |