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

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

Issue 10828410: Unify dart:isolate. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix mapping to dart:isolate. 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/config/import_vm.config ('k') | lib/isolate/dart2js/compiler_hooks.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 ReceivePort get port() => _port; 17 external ReceivePort get 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 SendPort spawnFunction(void topLevelFunction()) { 35 external SendPort spawnFunction(void topLevelFunction());
36 return _spawnFunction(topLevelFunction);
37 }
38 36
39 /** 37 /**
40 * Creates and spawns an isolate whose code is available at [uri]. Like with 38 * Creates and spawns an isolate whose code is available at [uri]. Like with
41 * [spawnFunction], the child isolate will have a default [ReceivePort], and a 39 * [spawnFunction], the child isolate will have a default [ReceivePort], and a
42 * this function returns a [SendPort] derived from it. 40 * this function returns a [SendPort] derived from it.
43 * 41 *
44 * See comments at the top of this library for more details. 42 * See comments at the top of this library for more details.
45 */ 43 */
46 SendPort spawnUri(String uri) { 44 external SendPort spawnUri(String uri);
47 return _spawnUri(uri);
48 }
49 45
50 /** 46 /**
51 * [SendPort]s are created from [ReceivePort]s. Any message sent through 47 * [SendPort]s are created from [ReceivePort]s. Any message sent through
52 * a [SendPort] is delivered to its respective [ReceivePort]. There might be 48 * a [SendPort] is delivered to its respective [ReceivePort]. There might be
53 * many [SendPort]s for the same [ReceivePort]. 49 * many [SendPort]s for the same [ReceivePort].
54 * 50 *
55 * [SendPort]s can be transmitted to other isolates. 51 * [SendPort]s can be transmitted to other isolates.
56 */ 52 */
57 interface SendPort extends Hashable { 53 interface SendPort extends Hashable {
58 54
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 SendPort toSendPort(); 135 SendPort toSendPort();
140 136
141 } 137 }
142 138
143 // TODO(kasperl): Make this hashable and document it. 139 // TODO(kasperl): Make this hashable and document it.
144 interface SendPortSync { 140 interface SendPortSync {
145 141
146 callSync(var message); 142 callSync(var message);
147 143
148 } 144 }
145
146 class _ReceivePortFactory {
147 external factory ReceivePort();
148 }
OLDNEW
« no previous file with comments | « lib/config/import_vm.config ('k') | lib/isolate/dart2js/compiler_hooks.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698