OLD | NEW |
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 |
| 10 #import('dart:isolate'); |
| 11 #import('dart:json'); |
9 | 12 |
10 $!GENERATED_DART_FILES | 13 $!GENERATED_DART_FILES |
11 | 14 |
12 #source('../../dom/src/EventListener.dart'); | 15 #source('../../dom/src/EventListener.dart'); |
13 #source('../../dom/src/KeyLocation.dart'); | 16 #source('../../dom/src/KeyLocation.dart'); |
14 #source('../../dom/src/KeyName.dart'); | 17 #source('../../dom/src/KeyName.dart'); |
15 #source('../../dom/src/ReadyState.dart'); | 18 #source('../../dom/src/ReadyState.dart'); |
16 #source('../../dom/src/_Collections.dart'); | 19 #source('../../dom/src/_Collections.dart'); |
17 #source('../../dom/src/_XMLHttpRequestUtils.dart'); | 20 #source('../../dom/src/_XMLHttpRequestUtils.dart'); |
18 #source('../../html/src/IDBOpenDBRequest.dart'); | 21 #source('../../html/src/IDBOpenDBRequest.dart'); |
19 #source('../../html/src/Measurement.dart'); | 22 #source('../../html/src/Measurement.dart'); |
20 #source('../../html/src/shared_FactoryProviders.dart'); | 23 #source('../../html/src/shared_FactoryProviders.dart'); |
21 #source('../../html/src/frog_DOMImplementation.dart'); | 24 #source('../../html/src/frog_DOMImplementation.dart'); |
22 #source('../../html/src/frog_FactoryProviders.dart'); | 25 #source('../../html/src/frog_FactoryProviders.dart'); |
23 #source('../../html/src/frog_IDBKeyRangeFactoryProvider.dart'); | 26 #source('../../html/src/frog_IDBKeyRangeFactoryProvider.dart'); |
24 #source('../../html/src/frog_IDBOpenDBRequestImplementation.dart'); | 27 #source('../../html/src/frog_IDBOpenDBRequestImplementation.dart'); |
25 #source('../../html/src/frog_LocationWrapper.dart'); | 28 #source('../../html/src/frog_LocationWrapper.dart'); |
26 #source('../../dom/src/frog_TypedArrayFactoryProvider.dart'); | 29 #source('../../dom/src/frog_TypedArrayFactoryProvider.dart'); |
27 #source('../../html/src/_Testing.dart'); | 30 #source('../../html/src/_Testing.dart'); |
28 #source('../../html/src/Device.dart'); | 31 #source('../../html/src/Device.dart'); |
29 #source('../../dom/src/_ListIterators.dart'); | 32 #source('../../dom/src/_ListIterators.dart'); |
30 #source('../../dom/src/_Lists.dart'); | 33 #source('../../dom/src/_Lists.dart'); |
| 34 #source('../../isolate/serialization.dart'); |
31 | 35 |
32 | 36 |
33 Window get window() native "return window;"; | 37 Window get window() native "return window;"; |
34 _WindowImpl get _window() native "return window;"; | 38 _WindowImpl get _window() native "return window;"; |
35 | 39 |
36 Document get document() native "return document;"; | 40 Document get document() native "return document;"; |
37 | 41 |
38 _DocumentImpl get _document() native "return document;"; | 42 _DocumentImpl get _document() native "return document;"; |
39 | 43 |
40 Element query(String selector) => _document.query(selector); | 44 Element query(String selector) => _document.query(selector); |
41 ElementList queryAll(String selector) => _document.queryAll(selector); | 45 ElementList queryAll(String selector) => _document.queryAll(selector); |
42 | 46 |
43 // Workaround for tags like <cite> that lack their own Element subclass -- | 47 // Workaround for tags like <cite> that lack their own Element subclass -- |
44 // Dart issue 1990. | 48 // Dart issue 1990. |
45 class _HTMLElementImpl extends _ElementImpl native "*HTMLElement" { | 49 class _HTMLElementImpl extends _ElementImpl native "*HTMLElement" { |
46 } | 50 } |
| 51 |
| 52 // TODO(vsm): Move this to a separate Isolates.dart file. |
| 53 _serialize(var message) { |
| 54 // TODO(kasperl): Specialize the serializer. |
| 55 return new _Serializer().traverse(message); |
| 56 } |
| 57 |
| 58 _deserialize(var message) { |
| 59 return new _JsDeserializer().deserialize(message); |
| 60 } |
| 61 |
| 62 class _JsDeserializer extends _Deserializer { |
| 63 |
| 64 deserializeSendPort(List x) { |
| 65 num id = x[1]; |
| 66 return new _JsSendPortSync(id); |
| 67 } |
| 68 |
| 69 } |
| 70 |
| 71 class _JsSendPortSync implements SendPortSync { |
| 72 |
| 73 num _id; |
| 74 _JsSendPortSync(this._id); |
| 75 |
| 76 callSync(var message) { |
| 77 var serialized = _serialize(message); |
| 78 var result = _call(_id, serialized); |
| 79 return _deserialize(result); |
| 80 } |
| 81 |
| 82 static _call(num id, var message) native @""" |
| 83 var deserialized = _deserialize(message); |
| 84 var result = ReceivePortSync.map[id].callback(deserialized); |
| 85 return _serialize(result); |
| 86 """; |
| 87 |
| 88 } |
OLD | NEW |