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

Unified Diff: compiler/lib/implementation/isolate.js

Issue 8440065: Simulate VM behavior wrt open receive ports. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comment. Created 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: compiler/lib/implementation/isolate.js
diff --git a/compiler/lib/implementation/isolate.js b/compiler/lib/implementation/isolate.js
index ade42a0e9a68a1b2cb01572433fdfe43d1b7e88e..ce79d67f778127cd715d0d4519d29576983cc85e 100644
--- a/compiler/lib/implementation/isolate.js
+++ b/compiler/lib/implementation/isolate.js
@@ -112,6 +112,10 @@ isolate$Registry.prototype.get = function(id) {
return this.map[id];
};
+isolate$Registry.prototype.contains = function(id) {
+ return this.map[id] !== void 0;
+};
+
isolate$Registry.prototype.isEmpty = function() {
return this.count === 0;
};
@@ -388,13 +392,15 @@ function isolate$doOneEventLoopIteration() {
if (!event) {
if (isolate$inWorker) {
isolate$closeWorkerIfNecessary();
- } else if (!isolate$isolateRegistry.isEmpty() &&
+ } else if (isolate$isolateRegistry.contains(isolate$rootIsolate.id) &&
isolate$workerRegistry.isEmpty() &&
!isolate$supportsWorkers && (typeof(window) == 'undefined')) {
- // This should only trigger when running on the command-line.
- // We don't want this check to execute in the browser where the isolate
- // might still be alive due to DOM callbacks.
- // throw Error("Program exited with open ReceivePorts.");
+ // No events anymore, but the main-worker still has open receive-ports.
+ // This simulates the VM's behavior (which instead times out).
+ // We only trigger this message when we run on the console (where we
+ // don't have workers). We don't want this check to execute in the browser
+ // where the isolate might still be alive due to DOM callbacks.
+ throw Error("Program exited with open ReceivePorts.");
}
return STOP_LOOP;
} else {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698