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

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

Issue 11783009: Big merge from experimental to bleeding edge. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sdk/lib/io/websocket_impl.dart ('k') | sdk/lib/isolate/isolate.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/isolate/base.dart
diff --git a/sdk/lib/isolate/base.dart b/sdk/lib/isolate/base.dart
index 93f8efee0bd3949b966249b045be6d9b3b12e7f0..c6c36e016f68bcb721a4669c31de0c8e14e2a5da 100644
--- a/sdk/lib/isolate/base.dart
+++ b/sdk/lib/isolate/base.dart
@@ -16,7 +16,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
@@ -33,9 +33,10 @@ 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(),
- [bool UnhandledExceptionCallback(IsolateUnhandledException e)]);
+SendPort spawnFunction(void topLevelFunction(),
+ [bool UnhandledExceptionCallback(IsolateUnhandledException e)])
+ => _Isolate.spawnFunction(topLevelFunction, UnhandledExceptionCallback);
+
/**
* Creates and spawns an isolate whose code is available at [uri]. Like with
* [spawnFunction], the child isolate will have a default [ReceivePort], and a
@@ -43,7 +44,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
@@ -145,6 +146,16 @@ abstract class SendPortSync {
}
+// The VM doesn't support accessing external globals in the same library. We
+// therefore create this wrapper class.
+// TODO(6997): Don't go through static class for external variables.
+abstract class _Isolate {
+ external static ReceivePort get port;
+ external static SendPort spawnFunction(void topLevelFunction(),
+ [bool UnhandledExceptionCallback(IsolateUnhandledException e)]);
+ external static SendPort spawnUri(String uri);
+}
+
/**
* Wraps unhandled exceptions thrown during isolate execution. It is
* used to show both the error message and the stack trace for unhandled
« no previous file with comments | « sdk/lib/io/websocket_impl.dart ('k') | sdk/lib/isolate/isolate.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698