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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: mojo/public/tools/bindings/generators/dart_templates/module_definition.tmpl
diff --git a/mojo/public/tools/bindings/generators/dart_templates/module_definition.tmpl b/mojo/public/tools/bindings/generators/dart_templates/module_definition.tmpl
index b22a7f3e6496d4d9b67d657e44fd2eb1447e7615..9a51005fccffd1e33cdab3d5617c769607d3c44b 100644
--- a/mojo/public/tools/bindings/generators/dart_templates/module_definition.tmpl
+++ b/mojo/public/tools/bindings/generators/dart_templates/module_definition.tmpl
@@ -38,12 +38,14 @@ var _runtimeTypeInfo;
{{typepkg}}RuntimeTypeInfo _initRuntimeTypeInfo() {
// serializedRuntimeTypeInfo contains the bytes of the Mojo serialization of
// a mojom_types.RuntimeTypeInfo struct describing the Mojom types in this
- // file.
- var serializedRuntimeTypeInfo = new Uint8List.fromList(const [{{serialized_runtime_type_info_literal}}]);
+ // file. The string contains the base64 encoding of the gzip-compressed bytes.
+ var serializedRuntimeTypeInfo = "{{module.serialized_runtime_type_info}}";
// Deserialize RuntimeTypeInfo
- var bdata = new ByteData.view(serializedRuntimeTypeInfo.buffer);
- var message = new bindings.Message(bdata, null, serializedRuntimeTypeInfo.length, 0);
+ var bytes = BASE64.decode(serializedRuntimeTypeInfo);
+ var unzippedBytes = new ZLibDecoder().convert(bytes);
+ var bdata = new ByteData.view(unzippedBytes.buffer);
+ var message = new bindings.Message(bdata, null, unzippedBytes.length, 0);
_runtimeTypeInfo = {{typepkg}}RuntimeTypeInfo.deserialize(message);
return _runtimeTypeInfo;
}

Powered by Google App Engine
This is Rietveld 408576698