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

Side by Side Diff: mojo/public/tools/bindings/generators/dart_templates/module_definition.tmpl

Issue 1776243004: Mojom runtime type info: Use compression and base64 encoding. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Rebasing Created 4 years, 9 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
OLDNEW
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
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 %}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698