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

Unified Diff: third_party/mojo/src/mojo/public/tools/bindings/generators/go_templates/struct.tmpl

Issue 954643002: Update mojo sdk to rev 3d23dae011859a2aae49f1d1adde705c8e85d819 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: use run_renderer_in_process() Created 5 years, 10 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/go_templates/struct.tmpl
diff --git a/third_party/mojo/src/mojo/public/tools/bindings/generators/go_templates/struct.tmpl b/third_party/mojo/src/mojo/public/tools/bindings/generators/go_templates/struct.tmpl
index eb6b1218cf947991ee03b4768f35d9b2243e0c6f..c9f044a63e6f500b4f93cd3a0b255ff8a2ff9e8c 100644
--- a/third_party/mojo/src/mojo/public/tools/bindings/generators/go_templates/struct.tmpl
+++ b/third_party/mojo/src/mojo/public/tools/bindings/generators/go_templates/struct.tmpl
@@ -10,7 +10,7 @@ type {{struct|name(exported)}} struct {
}
func (s *{{struct|name(exported)}}) Encode(encoder *bindings.Encoder) error {
- encoder.StartStruct({{struct.versions[-1].num_bytes}}, {{struct.packed.packed_fields|length}})
+ encoder.StartStruct({{struct.versions[-1].num_bytes}}, {{struct.versions[-1].version}})
{% for byte in struct.bytes %}
{% for packed_field in byte.packed_fields %}
{{encode('s.'~packed_field.field|name(exported), packed_field.field.kind)|tab_indent()}}
@@ -24,7 +24,7 @@ func (s *{{struct|name(exported)}}) Encode(encoder *bindings.Encoder) error {
func (s *{{struct|name(exported)}}) Decode(decoder *bindings.Decoder) error {
{% if struct.bytes %}
- numFields, err := decoder.StartStruct()
+ version, err := decoder.StartStruct()
{% else %}
_, err := decoder.StartStruct()
{% endif %}
@@ -33,7 +33,7 @@ func (s *{{struct|name(exported)}}) Decode(decoder *bindings.Decoder) error {
}
{% for byte in struct.bytes %}
{% for packed_field in byte.packed_fields %}
- if numFields > {{packed_field.ordinal}} {
+ if version >= {{packed_field.min_version}} {
{{decode('s.'~packed_field.field|name(exported), packed_field.field.kind)|tab_indent(2)}}
}
{% endfor %}

Powered by Google App Engine
This is Rietveld 408576698