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

Unified Diff: lib/isolate/dart2js/compiler_hooks.dart

Issue 10827436: Revert "Unify dart:isolate." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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 | « lib/isolate/base.dart ('k') | lib/isolate/dart2js/isolateimpl.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/isolate/dart2js/compiler_hooks.dart
diff --git a/lib/isolate/dart2js/compiler_hooks.dart b/lib/isolate/dart2js/compiler_hooks.dart
new file mode 100644
index 0000000000000000000000000000000000000000..052928a0db926e6c803d480f83ef57fee4ec6530
--- /dev/null
+++ b/lib/isolate/dart2js/compiler_hooks.dart
@@ -0,0 +1,35 @@
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// This file contains functions that are used in the code generated by
+// the dart2js compiler.
+
+/**
+ * Wrapper that takes the dart entry point and runs it within an isolate. The
+ * dart2js compiler will inject a call of the form
+ * [: startRootIsolate(main); :] when it determines that this wrapping
+ * is needed. For single-isolate applications (e.g. hello world), this
+ * call is not emitted.
+ */
+void startRootIsolate(entry) {
+ _globalState = new _Manager();
+
+ // Don't start the main loop again, if we are in a worker.
+ if (_globalState.isWorker) return;
+ final rootContext = new _IsolateContext();
+ _globalState.rootContext = rootContext;
+ _fillStatics(rootContext);
+
+ // BUG(5151491): Setting currentContext should not be necessary, but
+ // because closures passed to the DOM as event handlers do not bind their
+ // isolate automatically we try to give them a reasonable context to live in
+ // by having a "default" isolate (the first one created).
+ _globalState.currentContext = rootContext;
+
+ if (_window != null) {
+ rootContext.eval(() => _setTimerFactoryClosure( _timerFactory));
+ }
+ rootContext.eval(entry);
+ _globalState.topEventLoop.run();
+}
« no previous file with comments | « lib/isolate/base.dart ('k') | lib/isolate/dart2js/isolateimpl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698