Index: mojo/public/tools/bindings/generators/cpp_templates/struct_macros.tmpl |
diff --git a/mojo/public/tools/bindings/generators/cpp_templates/struct_macros.tmpl b/mojo/public/tools/bindings/generators/cpp_templates/struct_macros.tmpl |
index f28948aab179fafae4b28a5638cafca67b68d79b..08989492631f2dd823f7b3de70b9872e1ac6112c 100644 |
--- a/mojo/public/tools/bindings/generators/cpp_templates/struct_macros.tmpl |
+++ b/mojo/public/tools/bindings/generators/cpp_templates/struct_macros.tmpl |
@@ -113,7 +113,8 @@ |
- method parameters/response parameters: the output is a list of |
arguments. #} |
|context| is the name of the serialization context. |
-{%- macro deserialize(struct, input, output_field_pattern, context) -%} |
+ |success| is the name of a bool variable to track success of the operation. |
+{%- macro deserialize(struct, input, output_field_pattern, context, success) -%} |
do { |
// NOTE: The memory backing |{{input}}| may has be smaller than |
// |sizeof(*{{input}})| if the message comes from an older version. |
@@ -133,9 +134,11 @@ |
{%- endif %} |
{%- if kind|is_object_kind %} |
{%- if kind|is_union_kind %} |
- Deserialize_(&{{input}}->{{name}}, &{{output_field}}, {{context}}); |
+ if (!Deserialize_(&{{input}}->{{name}}, &{{output_field}}, {{context}})) |
+ {{success}} = false; |
{%- else %} |
- Deserialize_({{input}}->{{name}}.ptr, &{{output_field}}, {{context}}); |
+ if (!Deserialize_({{input}}->{{name}}.ptr, &{{output_field}}, {{context}})) |
+ {{success}} = false; |
{%- endif %} |
{%- elif kind|is_interface_kind %} |
mojo::internal::InterfaceDataToPointer(&{{input}}->{{name}}, &{{output_field}}); |