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

Side by Side Diff: sdk/lib/js/dart2js/js_dart2js.dart

Issue 25138003: Cache the context proxy. Don't use window for global 'this'. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 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 | « sdk/lib/_internal/lib/js_helper.dart ('k') | sdk/lib/js/dartium/js_dartium.dart » ('j') | 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 library dart.js; 5 library dart.js;
6 6
7 import 'dart:_foreign_helper' show JS; 7 import 'dart:_foreign_helper' show JS;
8 import 'dart:_js_helper' show convertDartClosureToJS; 8 import 'dart:_js_helper' show Primitives, convertDartClosureToJS;
9 9
10 JsObject get context { 10 final JsObject context = new JsObject._fromJs(Primitives.computeGlobalThis());
11 return new JsObject._fromJs(JS('=Object', 'window'));
12 }
13 11
14 JsObject jsify(dynamic data) => data == null ? null : new JsObject._json(data); 12 JsObject jsify(dynamic data) => data == null ? null : new JsObject._json(data);
15 13
16 class Callback implements Serializable<JsFunction> { 14 class Callback implements Serializable<JsFunction> {
17 final Function _f; // here to allow capture in closure 15 final Function _f; // here to allow capture in closure
18 final bool _withThis; // here to allow capture in closure 16 final bool _withThis; // here to allow capture in closure
19 dynamic _jsFunction; 17 dynamic _jsFunction;
20 18
21 Callback._(this._f, this._withThis) { 19 Callback._(this._f, this._withThis) {
22 _jsFunction = JS('=Object', r''' 20 _jsFunction = JS('=Object', r'''
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 JS('bool', 'typeof # == "boolean" || # instanceof Boolean', o, o)) { 190 JS('bool', 'typeof # == "boolean" || # instanceof Boolean', o, o)) {
193 return o; 191 return o;
194 } else if (JS('bool', '# instanceof Function', o)) { 192 } else if (JS('bool', '# instanceof Function', o)) {
195 return new JsFunction._fromJs(JS('=Object', '#', o)); 193 return new JsFunction._fromJs(JS('=Object', '#', o));
196 } else if (JS('bool', '# instanceof DartProxy', o)) { 194 } else if (JS('bool', '# instanceof DartProxy', o)) {
197 return JS('var', '#.o', o); 195 return JS('var', '#.o', o);
198 } else { 196 } else {
199 return new JsObject._fromJs(JS('=Object', '#', o)); 197 return new JsObject._fromJs(JS('=Object', '#', o));
200 } 198 }
201 } 199 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/lib/js_helper.dart ('k') | sdk/lib/js/dartium/js_dartium.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698