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

Unified Diff: sdk/lib/isolate/base.dart

Issue 11308154: Stream isolates. (Closed) Base URL: https://dart.googlecode.com/svn/experimental/lib_v2/dart
Patch Set: Fixes and test. Created 8 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 side-by-side diff with in-line comments
Download patch
Index: sdk/lib/isolate/base.dart
diff --git a/sdk/lib/isolate/base.dart b/sdk/lib/isolate/base.dart
index e43e3bbe9b0986ed4c208b6045c07cf861b58c73..a649ab907f85d060df5873dd96401d68d47be16b 100644
--- a/sdk/lib/isolate/base.dart
+++ b/sdk/lib/isolate/base.dart
@@ -14,7 +14,7 @@ class IsolateSpawnException implements Exception {
* the first communication between isolates (see [spawnFunction] and
* [spawnUri]).
*/
-external ReceivePort get port;
+ReceivePort get port => _Isolate.port;
/**
* Creates and spawns an isolate that shares the same code as the current
@@ -31,8 +31,8 @@ external ReceivePort get port;
*
* See comments at the top of this library for more details.
*/
-// Note this feature is not yet available in the dartvm.
-external SendPort spawnFunction(void topLevelFunction());
+SendPort spawnFunction(void topLevelFunction())
+ => _Isolate.spawnFunction(topLevelFunction);
/**
* Creates and spawns an isolate whose code is available at [uri]. Like with
@@ -41,7 +41,7 @@ external SendPort spawnFunction(void topLevelFunction());
*
* See comments at the top of this library for more details.
*/
-external SendPort spawnUri(String uri);
+SendPort spawnUri(String uri) => _Isolate.spawnUri(uri);
/**
* [SendPort]s are created from [ReceivePort]s. Any message sent through
@@ -142,3 +142,12 @@ abstract class SendPortSync {
callSync(var message);
}
+
+// The VM doesn't support accessing external globals in the same library. We
Ivan Posva 2012/11/26 18:56:40 Can you please elaborate what is missing from our
floitsch 2012/11/28 14:13:18 We cannot access external global variables from wi
+// therefore create this wrapper class.
+// TODO(floitsch): add bug-number.
+abstract class _Isolate {
+ external static ReceivePort get port;
+ external static SendPort spawnFunction(void topLevelFunction());
+ external static SendPort spawnUri(String uri);
+}

Powered by Google App Engine
This is Rietveld 408576698