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

Unified Diff: lib/dom/templates/html/frog/html_frog.darttemplate

Issue 10700101: First experimental steps towards a better story for JS interop. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments Created 8 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « client/dart.js ('k') | lib/dom/templates/html/frog/impl_Window.darttemplate » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/dom/templates/html/frog/html_frog.darttemplate
diff --git a/lib/dom/templates/html/frog/html_frog.darttemplate b/lib/dom/templates/html/frog/html_frog.darttemplate
index d364246feea018b82450705114ca2849c89e394d..392f7576f2f035acaf777cf94dfdd354208fba0e 100644
--- a/lib/dom/templates/html/frog/html_frog.darttemplate
+++ b/lib/dom/templates/html/frog/html_frog.darttemplate
@@ -5,7 +5,10 @@
// DO NOT EDIT
// Auto-generated dart:html library.
-#library("html");
+#library('html');
+
+#import('dart:isolate');
+#import('dart:json');
$!GENERATED_DART_FILES
@@ -28,6 +31,7 @@ $!GENERATED_DART_FILES
#source('../../html/src/Device.dart');
#source('../../dom/src/_ListIterators.dart');
#source('../../dom/src/_Lists.dart');
+#source('../../isolate/serialization.dart');
Window get window() native "return window;";
@@ -44,3 +48,41 @@ ElementList queryAll(String selector) => _document.queryAll(selector);
// Dart issue 1990.
class _HTMLElementImpl extends _ElementImpl native "*HTMLElement" {
}
+
+// TODO(vsm): Move this to a separate Isolates.dart file.
+_serialize(var message) {
+ // TODO(kasperl): Specialize the serializer.
+ return new _Serializer().traverse(message);
+}
+
+_deserialize(var message) {
+ return new _JsDeserializer().deserialize(message);
+}
+
+class _JsDeserializer extends _Deserializer {
+
+ deserializeSendPort(List x) {
+ num id = x[1];
+ return new _JsSendPortSync(id);
+ }
+
+}
+
+class _JsSendPortSync implements SendPortSync {
+
+ num _id;
+ _JsSendPortSync(this._id);
+
+ callSync(var message) {
+ var serialized = _serialize(message);
+ var result = _call(_id, serialized);
+ return _deserialize(result);
+ }
+
+ static _call(num id, var message) native @"""
+ var deserialized = _deserialize(message);
+ var result = ReceivePortSync.map[id].callback(deserialized);
+ return _serialize(result);
+ """;
+
+}
« no previous file with comments | « client/dart.js ('k') | lib/dom/templates/html/frog/impl_Window.darttemplate » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698