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

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

Issue 10843007: Cleanup isolate library after frog removal. (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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « lib/isolate/frog/messages.dart ('k') | lib/isolate/frog/ports.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 // Top-level native code needed by the frog compiler
6
7 var $globalThis = this;
8 var $globals = null;
9 var $globalState = null;
10 var $thisScriptUrl = null;
11 var $isWorker = typeof ($globalThis['importScripts']) != 'undefined';
12 var $supportsWorkers =
Siggi Cherem (dart-lang) 2012/08/01 21:17:29 please note: the current code for isolates in dart
13 $isWorker || ((typeof $globalThis['Worker']) != 'undefined');
14 function $initGlobals(context) { context.isolateStatics = {}; }
15 function $setGlobals(context) { $globals = context.isolateStatics; }
16
17 // Wrap a 0-arg dom-callback to bind it with the current isolate:
18 function $wrap_call$0(fn) { return fn && fn.wrap$call$0(); }
19
20 Function.prototype.wrap$call$0 = function() {
21 var isolateContext = $globalState.currentContext;
22 var self = this;
23 this.wrap$0 = function() {
24 var res = isolateContext.eval(self);
25 $globalState.topEventLoop.run();
26 return res;
27 };
28 this.wrap$call$0 = function() { return this.wrap$0; };
29 return this.wrap$0;
30 };
31
32 // Wrap a 1-arg dom-callback to bind it with the current isolate:
33 function $wrap_call$1(fn) { return fn && fn.wrap$call$1(); }
34
35 Function.prototype.wrap$call$1 = function() {
36 var isolateContext = $globalState.currentContext;
37 var self = this;
38 this.wrap$1 = function(arg) {
39 var res = isolateContext.eval(function() { return self(arg); });
40 $globalState.topEventLoop.run();
41 return res;
42 };
43 this.wrap$call$1 = function() { return this.wrap$1; };
44 return this.wrap$1;
45 };
46
47 // Wrap a 2-arg dom-callback to bind it with the current isolate:
48 function $wrap_call$2(fn) { return fn && fn.wrap$call$2(); }
49
50 Function.prototype.wrap$call$2 = function() {
51 var isolateContext = $globalState.currentContext;
52 var self = this;
53 this.wrap$2 = function(arg1, arg2) {
54 var res = isolateContext.eval(function() { return self(arg1, arg2); });
55 $globalState.topEventLoop.run();
56 return res;
57 };
58 this.wrap$call$2 = function() { return this.wrap$2; };
59 return this.wrap$2;
60 };
61
62 $thisScriptUrl = (function () {
63 if (!$supportsWorkers || $isWorker) return (void 0);
64
65 // TODO(5334778): Find a cross-platform non-brittle way of getting the
66 // currently running script.
67 var scripts = document.getElementsByTagName('script');
68 // The scripts variable only contains the scripts that have already been
69 // executed. The last one is the currently running script.
70 var script = scripts[scripts.length - 1];
71 var src = script && script.src;
72 if (!src) {
73 // TODO()
74 src = "FIXME:5407062" + "_" + Math.random().toString();
75 if (script) script.src = src;
76 }
77 return src;
78 })();
OLDNEW
« 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