OLD | NEW |
1 {#--- Constants #} | 1 {#--- Constants #} |
2 {%- for constant in module.constants %} | 2 {%- for constant in module.constants %} |
3 const {{constant.kind|dart_type}} {{constant|name}} = {{constant.resolved_value}
}; | 3 const {{constant.kind|dart_type}} {{constant|name}} = {{constant.resolved_value}
}; |
4 {%- endfor %} | 4 {%- endfor %} |
5 | 5 |
6 {#--- Enums #} | 6 {#--- Enums #} |
7 {%- from "enum_definition.tmpl" import enum_def %} | 7 {%- from "enum_definition.tmpl" import enum_def %} |
8 {%- for enum in enums %} | 8 {%- for enum in enums %} |
9 {{ enum_def(enum, typepkg, package) }} | 9 {{ enum_def(enum, typepkg, package) }} |
10 {%- endfor %} | 10 {%- endfor %} |
(...skipping 20 matching lines...) Expand all Loading... |
31 _initRuntimeTypeInfo(); | 31 _initRuntimeTypeInfo(); |
32 | 32 |
33 Map<String, {{typepkg}}UserDefinedType> getAllMojomTypeDefinitions() { | 33 Map<String, {{typepkg}}UserDefinedType> getAllMojomTypeDefinitions() { |
34 return getRuntimeTypeInfo().typeMap; | 34 return getRuntimeTypeInfo().typeMap; |
35 } | 35 } |
36 | 36 |
37 var _runtimeTypeInfo; | 37 var _runtimeTypeInfo; |
38 {{typepkg}}RuntimeTypeInfo _initRuntimeTypeInfo() { | 38 {{typepkg}}RuntimeTypeInfo _initRuntimeTypeInfo() { |
39 // serializedRuntimeTypeInfo contains the bytes of the Mojo serialization of | 39 // serializedRuntimeTypeInfo contains the bytes of the Mojo serialization of |
40 // a mojom_types.RuntimeTypeInfo struct describing the Mojom types in this | 40 // a mojom_types.RuntimeTypeInfo struct describing the Mojom types in this |
41 // file. | 41 // file. The string contains the base64 encoding of the gzip-compressed bytes. |
42 var serializedRuntimeTypeInfo = new Uint8List.fromList(const [{{serialized_run
time_type_info_literal}}]); | 42 var serializedRuntimeTypeInfo = "{{module.serialized_runtime_type_info}}"; |
43 | 43 |
44 // Deserialize RuntimeTypeInfo | 44 // Deserialize RuntimeTypeInfo |
45 var bdata = new ByteData.view(serializedRuntimeTypeInfo.buffer); | 45 var bytes = BASE64.decode(serializedRuntimeTypeInfo); |
46 var message = new bindings.Message(bdata, null, serializedRuntimeTypeInfo.leng
th, 0); | 46 var unzippedBytes = new ZLibDecoder().convert(bytes); |
| 47 var bdata = new ByteData.view(unzippedBytes.buffer); |
| 48 var message = new bindings.Message(bdata, null, unzippedBytes.length, 0); |
47 _runtimeTypeInfo = {{typepkg}}RuntimeTypeInfo.deserialize(message); | 49 _runtimeTypeInfo = {{typepkg}}RuntimeTypeInfo.deserialize(message); |
48 return _runtimeTypeInfo; | 50 return _runtimeTypeInfo; |
49 } | 51 } |
50 | 52 |
51 {%- endif %} | 53 {%- endif %} |
OLD | NEW |