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

Side by Side Diff: pkg/browser/lib/interop.js

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 | « no previous file | sdk/lib/_internal/lib/isolate_helper.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 // --------------------------------------------------------------------------- 5 // ---------------------------------------------------------------------------
6 // Support for JS interoperability 6 // Support for JS interoperability
7 // --------------------------------------------------------------------------- 7 // ---------------------------------------------------------------------------
8 function SendPortSync() { 8 function SendPortSync() {
9 } 9 }
10 10
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 window.addEventListener(source, listener, false); 217 window.addEventListener(source, listener, false);
218 dispatchEvent(target, [source, serialized]); 218 dispatchEvent(target, [source, serialized]);
219 window.removeEventListener(source, listener, false); 219 window.removeEventListener(source, listener, false);
220 return deserialize(result); 220 return deserialize(result);
221 } 221 }
222 })(); 222 })();
223 223
224 (function() { 224 (function() {
225 // Proxy support for js.dart. 225 // Proxy support for js.dart.
226 226
227 var globalContext = window; 227 // We don't use 'window' because we might be in a web worker, but we don't
228 // use 'self' because not all browsers support it
229 var globalContext = function() { return this; }();
228 230
229 // Table for local objects and functions that are proxied. 231 // Table for local objects and functions that are proxied.
230 function ProxiedObjectTable() { 232 function ProxiedObjectTable() {
231 // Name for debugging. 233 // Name for debugging.
232 this.name = 'js-ref'; 234 this.name = 'js-ref';
233 235
234 // Table from IDs to JS objects. 236 // Table from IDs to JS objects.
235 this.map = {}; 237 this.map = {};
236 238
237 // Generator for new IDs. 239 // Generator for new IDs.
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 port.receive(f); 532 port.receive(f);
531 window.registerPort(name, port.toSendPort()); 533 window.registerPort(name, port.toSendPort());
532 } 534 }
533 535
534 makeGlobalPort('dart-js-context', context); 536 makeGlobalPort('dart-js-context', context);
535 makeGlobalPort('dart-js-create', construct); 537 makeGlobalPort('dart-js-create', construct);
536 makeGlobalPort('dart-js-instanceof', proxyInstanceof); 538 makeGlobalPort('dart-js-instanceof', proxyInstanceof);
537 makeGlobalPort('dart-js-delete-property', proxyDeleteProperty); 539 makeGlobalPort('dart-js-delete-property', proxyDeleteProperty);
538 makeGlobalPort('dart-js-convert', proxyConvert); 540 makeGlobalPort('dart-js-convert', proxyConvert);
539 })(); 541 })();
OLDNEW
« no previous file with comments | « no previous file | sdk/lib/_internal/lib/isolate_helper.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698