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

Unified Diff: sdk/lib/_internal/js_runtime/lib/isolate_patch.dart

Issue 1286193006: Make Dart2js implement the onExit/onError/errorsAreFatal parameters to spawnUri. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Address comments Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | 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/_internal/js_runtime/lib/isolate_patch.dart
diff --git a/sdk/lib/_internal/js_runtime/lib/isolate_patch.dart b/sdk/lib/_internal/js_runtime/lib/isolate_patch.dart
index 82ef73fc79cc0e303c2f0a93b3a0ad311b1af70a..907f275fd3e26ed99e8b097836312582e962a014 100644
--- a/sdk/lib/_internal/js_runtime/lib/isolate_patch.dart
+++ b/sdk/lib/_internal/js_runtime/lib/isolate_patch.dart
@@ -41,6 +41,9 @@ class Isolate {
{bool paused: false, bool checked, Uri packageRoot, bool errorsAreFatal,
SendPort onExit, SendPort onError}) {
if (packageRoot != null) throw new UnimplementedError("packageRoot");
+ bool forcePause = (errorsAreFatal != null) ||
+ (onExit != null) ||
+ (onError != null);
try {
if (args is List<String>) {
for (int i = 0; i < args.length; i++) {
@@ -51,10 +54,30 @@ class Isolate {
} else if (args != null) {
throw new ArgumentError("Args must be a list of Strings $args");
}
- return IsolateNatives.spawnUri(uri, args, message, paused)
- .then((msg) => new Isolate(msg[1],
- pauseCapability: msg[2],
- terminateCapability: msg[3]));
+ // TODO: Consider passing the errorsAreFatal/onExit/onError values
+ // as arguments to the internal spawnUri instead of setting
+ // them after the isolate has been created.
+ return IsolateNatives.spawnUri(uri, args, message, paused || forcePause)
+ .then((msg) {
+ var isolate = new Isolate(msg[1],
+ pauseCapability: msg[2],
+ terminateCapability: msg[3]);
+ if (forcePause) {
+ if (errorsAreFatal != null) {
+ isolate.setErrorsFatal(errorsAreFatal);
+ }
+ if (onExit != null) {
+ isolate.addOnExitListener(onExit);
+ }
+ if (onError != null) {
+ isolate.addOnErrorListener(onError);
+ }
+ if (!paused) {
+ isolate.resume(Isolate.pauseCapability);
+ }
+ }
+ return isolate;
+ });
} catch (e, st) {
return new Future<Isolate>.error(e, st);
}
« no previous file with comments | « no previous file | sdk/lib/isolate/isolate.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698