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

Unified Diff: lib/isolate/frog/natives.js

Issue 9422019: isolates refactor: this change introduces 'dart:isolate' as a library. This is a (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: '' Created 8 years, 10 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/frog/messages.dart ('k') | lib/isolate/frog/ports.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/isolate/frog/natives.js
diff --git a/lib/isolate/frog/natives.js b/lib/isolate/frog/natives.js
new file mode 100644
index 0000000000000000000000000000000000000000..777255022ed5946876fb084cbf6f71cb1b03e38c
--- /dev/null
+++ b/lib/isolate/frog/natives.js
@@ -0,0 +1,37 @@
+// 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.
+
+// Top-level native code needed by the frog compiler
+
+var $globalThis = this;
+var $globals = null;
+var $globalState = null;
+
+// Wrap a 0-arg dom-callback to bind it with the current isolate:
+function $wrap_call$0(fn) { return fn && fn.wrap$call$0(); }
+
+Function.prototype.wrap$call$0 = function() {
+ var isolateContext = $globalState.currentContext;
+ var self = this;
+ this.wrap$0 = function() {
+ isolateContext.eval(self);
+ $globalState.topEventLoop.run();
+ };
+ this.wrap$call$0 = function() { return this.wrap$0; };
+ return this.wrap$0;
+};
+
+// Wrap a 1-arg dom-callback to bind it with the current isolate:
+function $wrap_call$1(fn) { return fn && fn.wrap$call$1(); }
+
+Function.prototype.wrap$call$1 = function() {
+ var isolateContext = $globalState.currentContext;
+ var self = this;
+ this.wrap$1 = function(arg) {
+ isolateContext.eval(function() { self(arg); });
+ $globalState.topEventLoop.run();
+ };
+ this.wrap$call$1 = function() { return this.wrap$1; };
+ return this.wrap$1;
+};
« no previous file with comments | « lib/isolate/frog/messages.dart ('k') | lib/isolate/frog/ports.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698