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

Side by Side Diff: lib/isolate/frog/natives.js

Issue 9662046: Isolate library changes for leg support. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 // Top-level native code needed by the frog compiler 5 // Top-level native code needed by the frog compiler
6 6
7 var $globalThis = this; 7 var $globalThis = this;
8 var $globals = null; 8 var $globals = null;
9 var $globalState = null; 9 var $globalState = null;
10 function $initGlobals(context) { context.isolateStatics = {}; }
11 function $setGlobals(context) { $globals = context.isolateStatics; }
ngeoffray 2012/03/11 15:43:54 That's the Frog specific implementation.
10 12
11 // Wrap a 0-arg dom-callback to bind it with the current isolate: 13 // Wrap a 0-arg dom-callback to bind it with the current isolate:
12 function $wrap_call$0(fn) { return fn && fn.wrap$call$0(); } 14 function $wrap_call$0(fn) { return fn && fn.wrap$call$0(); }
13 15
14 Function.prototype.wrap$call$0 = function() { 16 Function.prototype.wrap$call$0 = function() {
15 var isolateContext = $globalState.currentContext; 17 var isolateContext = $globalState.currentContext;
16 var self = this; 18 var self = this;
17 this.wrap$0 = function() { 19 this.wrap$0 = function() {
18 isolateContext.eval(self); 20 isolateContext.eval(self);
19 $globalState.topEventLoop.run(); 21 $globalState.topEventLoop.run();
20 }; 22 };
21 this.wrap$call$0 = function() { return this.wrap$0; }; 23 this.wrap$call$0 = function() { return this.wrap$0; };
22 return this.wrap$0; 24 return this.wrap$0;
23 }; 25 };
24 26
25 // Wrap a 1-arg dom-callback to bind it with the current isolate: 27 // Wrap a 1-arg dom-callback to bind it with the current isolate:
26 function $wrap_call$1(fn) { return fn && fn.wrap$call$1(); } 28 function $wrap_call$1(fn) { return fn && fn.wrap$call$1(); }
27 29
28 Function.prototype.wrap$call$1 = function() { 30 Function.prototype.wrap$call$1 = function() {
29 var isolateContext = $globalState.currentContext; 31 var isolateContext = $globalState.currentContext;
30 var self = this; 32 var self = this;
31 this.wrap$1 = function(arg) { 33 this.wrap$1 = function(arg) {
32 isolateContext.eval(function() { self(arg); }); 34 isolateContext.eval(function() { self(arg); });
33 $globalState.topEventLoop.run(); 35 $globalState.topEventLoop.run();
34 }; 36 };
35 this.wrap$call$1 = function() { return this.wrap$1; }; 37 this.wrap$call$1 = function() { return this.wrap$1; };
36 return this.wrap$1; 38 return this.wrap$1;
37 }; 39 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698