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

Side by Side Diff: lib/dom/templates/html/dartium/html_dartium.darttemplate

Issue 10700102: Make the new JS interop test pass on Dartium. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « client/dart.js ('k') | lib/dom/templates/html/dartium/impl_Window.darttemplate » ('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) 2012, the Dart project authors. Please see the AUTHORS file 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 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 // DO NOT EDIT 5 // DO NOT EDIT
6 // Auto-generated dart:html library. 6 // Auto-generated dart:html library.
7 7
8 #library("html"); 8 #library("html");
9 9
10 #import("dart:isolate"); 10 #import("dart:isolate");
11 #import("dart:json");
11 #import("dart:nativewrappers"); 12 #import("dart:nativewrappers");
12 13
13 $!GENERATED_DART_FILES 14 $!GENERATED_DART_FILES
14 15
15 #source('$AUXILIARY_DIR/EventListener.dart'); 16 #source('$AUXILIARY_DIR/EventListener.dart');
16 #source('$AUXILIARY_DIR/KeyLocation.dart'); 17 #source('$AUXILIARY_DIR/KeyLocation.dart');
17 #source('$AUXILIARY_DIR/KeyName.dart'); 18 #source('$AUXILIARY_DIR/KeyName.dart');
18 #source('$AUXILIARY_DIR/ReadyState.dart'); 19 #source('$AUXILIARY_DIR/ReadyState.dart');
19 #source('$AUXILIARY_DIR/_Collections.dart'); 20 #source('$AUXILIARY_DIR/_Collections.dart');
20 #source('$AUXILIARY_DIR/_XMLHttpRequestUtils.dart'); 21 #source('$AUXILIARY_DIR/_XMLHttpRequestUtils.dart');
21 #source('$AUXILIARY_DIR/../../html/src/shared_FactoryProviders.dart'); 22 #source('$AUXILIARY_DIR/../../html/src/shared_FactoryProviders.dart');
22 #source('$AUXILIARY_DIR/../../html/src/dartium_FactoryProviders.dart'); 23 #source('$AUXILIARY_DIR/../../html/src/dartium_FactoryProviders.dart');
23 #source('$AUXILIARY_DIR/../../html/src/IDBOpenDBRequest.dart'); 24 #source('$AUXILIARY_DIR/../../html/src/IDBOpenDBRequest.dart');
24 #source('$AUXILIARY_DIR/../../html/src/Measurement.dart'); 25 #source('$AUXILIARY_DIR/../../html/src/Measurement.dart');
25 #source('$AUXILIARY_DIR/../../html/src/Device.dart'); 26 #source('$AUXILIARY_DIR/../../html/src/Device.dart');
26 #source('$AUXILIARY_DIR/../../html/src/_Testing.dart'); 27 #source('$AUXILIARY_DIR/../../html/src/_Testing.dart');
27 #source('$AUXILIARY_DIR/_ListIterators.dart'); 28 #source('$AUXILIARY_DIR/_ListIterators.dart');
28 #source('$AUXILIARY_DIR/_Lists.dart'); 29 #source('$AUXILIARY_DIR/_Lists.dart');
30 #source('$AUXILIARY_DIR/../../isolate/serialization.dart');
29 31
30 #source('$AUXILIARY_DIR/native_DOMPublic.dart'); 32 #source('$AUXILIARY_DIR/native_DOMPublic.dart');
31 #source('$AUXILIARY_DIR/native_DOMImplementation.dart'); 33 #source('$AUXILIARY_DIR/native_DOMImplementation.dart');
32 34
33 Window __window; 35 Window __window;
34 36
35 Window get window() { 37 Window get window() {
36 if (__window !== null) { 38 if (__window !== null) {
37 return __window; 39 return __window;
38 } 40 }
(...skipping 16 matching lines...) Expand all
55 Document get _document() => _window.document; 57 Document get _document() => _window.document;
56 58
57 Element query(String selector) => _document.query(selector); 59 Element query(String selector) => _document.query(selector);
58 ElementList queryAll(String selector) => _document.queryAll(selector); 60 ElementList queryAll(String selector) => _document.queryAll(selector);
59 61
60 class _Null { 62 class _Null {
61 const _Null(); 63 const _Null();
62 } 64 }
63 65
64 final _null = const _Null(); 66 final _null = const _Null();
67
68 // TODO(vsm): Move this to a separate Isolates.dart file.
69 _serialize(var message) {
70 // TODO(kasperl): Specialize the serializer.
71 return new _Serializer().traverse(message);
72 }
73
74 _deserialize(var message) {
75 return new _JsDeserializer().deserialize(message);
76 }
77
78 class _JsDeserializer extends _Deserializer {
79
80 deserializeSendPort(List x) {
81 num id = x[1];
82 return new _JsSendPortSync(id);
83 }
84
85 }
86
87 class _JsSendPortSync implements SendPortSync {
88
89 static bool initialized = false;
90 static var lastResult = null;
91
92 num _id;
93 _JsSendPortSync(this._id) {
94 if (initialized) return;
95 window.on['js-result'].add((event) {
96 lastResult = JSON.parse(event.data);
97 }, false);
98 initialized = true;
99 }
100
101 callSync(var message) {
102 var serialized = _serialize(message);
103 var result = _callUsingEvent(_id, serialized);
104 return _deserialize(result);
105 }
106
107 static _callUsingEvent(num id, var message) {
108 var data = JSON.stringify({ 'id': id, 'message': message });
109 var event = document.$dom_createEvent('TextEvent');
110 event.initTextEvent('js-sync-message', false, false, window, data);
111 assert(lastResult == null);
112 window.$dom_dispatchEvent(event);
113 var result = lastResult;
114 lastResult = null;
115 return result;
116 }
117
118 }
OLDNEW
« no previous file with comments | « client/dart.js ('k') | lib/dom/templates/html/dartium/impl_Window.darttemplate » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698