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

Side by Side 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: 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 var isolate$current = null; 5 var isolate$current = null;
6 var isolate$rootIsolate = null; // Will only be set in the main worker. 6 var isolate$rootIsolate = null; // Will only be set in the main worker.
7 var isolate$inits = []; 7 var isolate$inits = [];
8 var isolate$globalThis = this; 8 var isolate$globalThis = this;
9 9
10 // These declarations are needed to avoid errors from the Closure Compiler 10 // These declarations are needed to avoid errors from the Closure Compiler
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 isolate$mainWorker.postMessage( { command: 'close' } ); 381 isolate$mainWorker.postMessage( { command: 'close' } );
382 } 382 }
383 383
384 function isolate$doOneEventLoopIteration() { 384 function isolate$doOneEventLoopIteration() {
385 var CONTINUE_LOOP = true; 385 var CONTINUE_LOOP = true;
386 var STOP_LOOP = false; 386 var STOP_LOOP = false;
387 var event = isolate$IsolateEvent.dequeue(); 387 var event = isolate$IsolateEvent.dequeue();
388 if (!event) { 388 if (!event) {
389 if (isolate$inWorker) { 389 if (isolate$inWorker) {
390 isolate$closeWorkerIfNecessary(); 390 isolate$closeWorkerIfNecessary();
391 } else if (!isolate$isolateRegistry.isEmpty() && 391 } else if (isolate$isolateRegistry.get(isolate$rootIsolate.id) &&
kasperl 2011/11/03 13:16:00 I would compare this against null.
floitsch 2011/11/03 13:28:53 added .contains method.
392 isolate$workerRegistry.isEmpty() && 392 isolate$workerRegistry.isEmpty() &&
393 !isolate$supportsWorkers && (typeof(window) == 'undefined')) { 393 !isolate$supportsWorkers && (typeof(window) == 'undefined')) {
394 // This should only trigger when running on the command-line. 394 // No events anymore, but the main-worker still has open receive-ports.
395 // We don't want this check to execute in the browser where the isolate 395 // This simulates the VM's behavior (which instead times out).
396 // might still be alive due to DOM callbacks. 396 // We only trigger this message when we run on the console (where we
397 // throw Error("Program exited with open ReceivePorts."); 397 // don't have workers). We don't want this check to execute in the browser
398 // where the isolate might still be alive due to DOM callbacks.
399 throw Error("Program exited with open ReceivePorts.");
398 } 400 }
399 return STOP_LOOP; 401 return STOP_LOOP;
400 } else { 402 } else {
401 event.process(); 403 event.process();
402 return CONTINUE_LOOP; 404 return CONTINUE_LOOP;
403 } 405 }
404 } 406 }
405 407
406 function isolate$doRunEventLoop() { 408 function isolate$doRunEventLoop() {
407 if (typeof window != 'undefined' && window.setTimeout) { 409 if (typeof window != 'undefined' && window.setTimeout) {
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 } 509 }
508 510
509 function isolate$deserializeMessage(message) { 511 function isolate$deserializeMessage(message) {
510 if (isolate$useWorkers || isolate$useWorkerSerializationProtocol) { 512 if (isolate$useWorkers || isolate$useWorkerSerializationProtocol) {
511 return native__IsolateJsUtil__deserializeMessage(message); 513 return native__IsolateJsUtil__deserializeMessage(message);
512 } else { 514 } else {
513 // Nothing more to do. 515 // Nothing more to do.
514 return message; 516 return message;
515 } 517 }
516 } 518 }
OLDNEW
« 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