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

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

Issue 10827436: Revert "Unify dart:isolate." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 4 months 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 | « lib/isolate/isolate.dart ('k') | lib/isolate/isolate_compiler.dart » ('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) 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 class IsolateSpawnException implements Exception { 5 class IsolateSpawnException implements Exception {
6 const IsolateSpawnException(String this._s); 6 const IsolateSpawnException(String this._s);
7 String toString() => "IsolateSpawnException: '$_s'"; 7 String toString() => "IsolateSpawnException: '$_s'";
8 final String _s; 8 final String _s;
9 } 9 }
10 10
11 /** 11 /**
12 * The initial [ReceivePort] available by default for this isolate. This 12 * The initial [ReceivePort] available by default for this isolate. This
13 * [ReceivePort] is created automatically and it is commonly used to establish 13 * [ReceivePort] is created automatically and it is commonly used to establish
14 * the first communication between isolates (see [spawnFunction] and 14 * the first communication between isolates (see [spawnFunction] and
15 * [spawnUri]). 15 * [spawnUri]).
16 */ 16 */
17 external ReceivePort get port(); 17 ReceivePort get port() => _port;
18 18
19 /** 19 /**
20 * Creates and spawns an isolate that shares the same code as the current 20 * Creates and spawns an isolate that shares the same code as the current
21 * isolate, but that starts from [topLevelFunction]. The [topLevelFunction] 21 * isolate, but that starts from [topLevelFunction]. The [topLevelFunction]
22 * argument must be a static top-level function or a static method that takes no 22 * argument must be a static top-level function or a static method that takes no
23 * arguments. It is illegal to pass a function closure. 23 * arguments. It is illegal to pass a function closure.
24 * 24 *
25 * When any isolate starts (even the main script of the application), a default 25 * When any isolate starts (even the main script of the application), a default
26 * [ReceivePort] is created for it. This port is available from the top-level 26 * [ReceivePort] is created for it. This port is available from the top-level
27 * getter [port] defined in this library. 27 * getter [port] defined in this library.
28 * 28 *
29 * [spawnFunction] returns a [SendPort] derived from the child isolate's default 29 * [spawnFunction] returns a [SendPort] derived from the child isolate's default
30 * port. 30 * port.
31 * 31 *
32 * See comments at the top of this library for more details. 32 * See comments at the top of this library for more details.
33 */ 33 */
34 // Note this feature is not yet available in the dartvm. 34 // Note this feature is not yet available in the dartvm.
35 external SendPort spawnFunction(void topLevelFunction()); 35 SendPort spawnFunction(void topLevelFunction()) {
36 return _spawnFunction(topLevelFunction);
37 }
36 38
37 /** 39 /**
38 * Creates and spawns an isolate whose code is available at [uri]. Like with 40 * Creates and spawns an isolate whose code is available at [uri]. Like with
39 * [spawnFunction], the child isolate will have a default [ReceivePort], and a 41 * [spawnFunction], the child isolate will have a default [ReceivePort], and a
40 * this function returns a [SendPort] derived from it. 42 * this function returns a [SendPort] derived from it.
41 * 43 *
42 * See comments at the top of this library for more details. 44 * See comments at the top of this library for more details.
43 */ 45 */
44 external SendPort spawnUri(String uri); 46 SendPort spawnUri(String uri) {
47 return _spawnUri(uri);
48 }
45 49
46 /** 50 /**
47 * [SendPort]s are created from [ReceivePort]s. Any message sent through 51 * [SendPort]s are created from [ReceivePort]s. Any message sent through
48 * a [SendPort] is delivered to its respective [ReceivePort]. There might be 52 * a [SendPort] is delivered to its respective [ReceivePort]. There might be
49 * many [SendPort]s for the same [ReceivePort]. 53 * many [SendPort]s for the same [ReceivePort].
50 * 54 *
51 * [SendPort]s can be transmitted to other isolates. 55 * [SendPort]s can be transmitted to other isolates.
52 */ 56 */
53 interface SendPort extends Hashable { 57 interface SendPort extends Hashable {
54 58
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 SendPort toSendPort(); 139 SendPort toSendPort();
136 140
137 } 141 }
138 142
139 // TODO(kasperl): Make this hashable and document it. 143 // TODO(kasperl): Make this hashable and document it.
140 interface SendPortSync { 144 interface SendPortSync {
141 145
142 callSync(var message); 146 callSync(var message);
143 147
144 } 148 }
145
146 class _ReceivePortFactory {
147 external factory ReceivePort();
148 }
OLDNEW
« no previous file with comments | « lib/isolate/isolate.dart ('k') | lib/isolate/isolate_compiler.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698