OLD | NEW |
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 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
450 var port = message[2]; | 450 var port = message[2]; |
451 // TODO(vsm): Add a more robust check for a local SendPortSync. | 451 // TODO(vsm): Add a more robust check for a local SendPortSync. |
452 if ("receivePort" in port) { | 452 if ("receivePort" in port) { |
453 // Local object. | 453 // Local object. |
454 return proxiedObjectTable.get(id); | 454 return proxiedObjectTable.get(id); |
455 } else { | 455 } else { |
456 // Remote object. | 456 // Remote object. |
457 if (proxiedObjectTable.contains(id)) { | 457 if (proxiedObjectTable.contains(id)) { |
458 return proxiedObjectTable.get(id); | 458 return proxiedObjectTable.get(id); |
459 } | 459 } |
460 proxy = new DartObject(id, port); | 460 var proxy = new DartObject(id, port); |
461 proxiedObjectTable.add(proxy, id); | 461 proxiedObjectTable.add(proxy, id); |
462 return proxy; | 462 return proxy; |
463 } | 463 } |
464 } | 464 } |
465 | 465 |
466 // Remote handler to construct a new JavaScript object given its | 466 // Remote handler to construct a new JavaScript object given its |
467 // serialized constructor and arguments. | 467 // serialized constructor and arguments. |
468 function construct(args) { | 468 function construct(args) { |
469 args = args.map(deserialize); | 469 args = args.map(deserialize); |
470 var constructor = args[0]; | 470 var constructor = args[0]; |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
528 port.receive(f); | 528 port.receive(f); |
529 window.registerPort(name, port.toSendPort()); | 529 window.registerPort(name, port.toSendPort()); |
530 } | 530 } |
531 | 531 |
532 makeGlobalPort('dart-js-context', context); | 532 makeGlobalPort('dart-js-context', context); |
533 makeGlobalPort('dart-js-create', construct); | 533 makeGlobalPort('dart-js-create', construct); |
534 makeGlobalPort('dart-js-instanceof', proxyInstanceof); | 534 makeGlobalPort('dart-js-instanceof', proxyInstanceof); |
535 makeGlobalPort('dart-js-delete-property', proxyDeleteProperty); | 535 makeGlobalPort('dart-js-delete-property', proxyDeleteProperty); |
536 makeGlobalPort('dart-js-convert', proxyConvert); | 536 makeGlobalPort('dart-js-convert', proxyConvert); |
537 })(); | 537 })(); |
OLD | NEW |