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

Unified Diff: third_party/mojo/src/mojo/public/tools/bindings/generators/java_templates/struct_definition.tmpl

Issue 1127293003: Update mojo sdk to rev f84766d3b6420b7cf6a113d9d65d73cb5fe18d90 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: formatting Created 5 years, 7 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: third_party/mojo/src/mojo/public/tools/bindings/generators/java_templates/struct_definition.tmpl
diff --git a/third_party/mojo/src/mojo/public/tools/bindings/generators/java_templates/struct_definition.tmpl b/third_party/mojo/src/mojo/public/tools/bindings/generators/java_templates/struct_definition.tmpl
index f0cb98298c9f054176916254b406f246f987b7f2..76c07fde69ecb95e16b70acc0c0498aa4600ecb2 100644
--- a/third_party/mojo/src/mojo/public/tools/bindings/generators/java_templates/struct_definition.tmpl
+++ b/third_party/mojo/src/mojo/public/tools/bindings/generators/java_templates/struct_definition.tmpl
@@ -132,17 +132,21 @@ if (decoder{{level+1}} == null) {
{% endfor %}
{% endif %}
- public {{struct|name}}() {
- super(STRUCT_SIZE);
+ private {{struct|name}}(int version) {
+ super(STRUCT_SIZE, version);
{% for field in struct.fields %}
{% if field.default %}
{{field|name}} = {{field|default_value}};
-{% elif field.kind|is_handle %}
+{% elif field.kind|is_any_handle_kind and not field.kind|is_interface_request_kind %}
{{field|name}} = org.chromium.mojo.system.InvalidHandle.INSTANCE;
{% endif %}
{% endfor %}
}
+ public {{struct|name}}() {
+ this({{struct.versions[-1].version}});
+ }
+
public static {{struct|name}} deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
@@ -152,12 +156,8 @@ if (decoder{{level+1}} == null) {
if (decoder0 == null) {
return null;
}
- {{struct|name}} result = new {{struct|name}}();
-{% if not struct.bytes %}
- decoder0.readAndValidateDataHeader(VERSION_ARRAY);
-{% else %}
DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
-{% endif %}
+ {{struct|name}} result = new {{struct|name}}(mainDataHeader.elementsOrVersion);
{% for byte in struct.bytes %}
{% for packed_field in byte.packed_fields %}
if (mainDataHeader.elementsOrVersion >= {{packed_field.min_version}}) {

Powered by Google App Engine
This is Rietveld 408576698