Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(159)

Side by Side Diff: runtime/lib/isolate.dart

Issue 8457005: convert isolates to use Future (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: updated co19 Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « frog/lib/isolate.dart ('k') | tests/co19/co19-runtime.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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() {
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 // Forward the implementation of sending messages to the VM. Only port ids 128 // Forward the implementation of sending messages to the VM. Only port ids
129 // are being handed to the VM. 129 // are being handed to the VM.
130 static _sendInternal(int sendId, int replyId, var message) 130 static _sendInternal(int sendId, int replyId, var message)
131 native "SendPortImpl_sendInternal_"; 131 native "SendPortImpl_sendInternal_";
132 132
133 final int _id; 133 final int _id;
134 } 134 }
135 135
136 136
137 class IsolateNatives { 137 class IsolateNatives {
138 static Promise<SendPort> spawn(Isolate isolate, bool isLight) { 138 static Future<SendPort> spawn(Isolate isolate, bool isLight) {
139 Promise<SendPort> result = new Promise<SendPort>(); 139 Completer<SendPort> completer = new Completer<SendPort>();
140 SendPort port = _start(isolate, isLight); 140 SendPort port = _start(isolate, isLight);
141 result.complete(port); 141 completer.complete(port);
142 return result; 142 return completer.future;
143 } 143 }
144 144
145 // Starts a new isolate calling the run method on a new instance of the 145 // Starts a new isolate calling the run method on a new instance of the
146 // remote class's type. 146 // remote class's type.
147 // Returns the send port which is passed to the newly created isolate. 147 // Returns the send port which is passed to the newly created isolate.
148 // This method is being dispatched to from the public core library code. 148 // This method is being dispatched to from the public core library code.
149 static SendPort _start(Isolate isolate, bool light) 149 static SendPort _start(Isolate isolate, bool light)
150 native "IsolateNatives_start"; 150 native "IsolateNatives_start";
151 } 151 }
OLDNEW
« no previous file with comments | « frog/lib/isolate.dart ('k') | tests/co19/co19-runtime.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698