| OLD | NEW |
| 1 {%- import "interface_macros.tmpl" as interface_macros %} | 1 {%- import "interface_macros.tmpl" as interface_macros %} |
| 2 {%- import "struct_macros.tmpl" as struct_macros %} | 2 {%- import "struct_macros.tmpl" as struct_macros %} |
| 3 | 3 |
| 4 {%- set class_name = interface.name %} | 4 {%- set class_name = interface.name %} |
| 5 {%- set proxy_name = interface.name ~ "Proxy" %} | 5 {%- set proxy_name = interface.name ~ "Proxy" %} |
| 6 {%- set namespace_as_string = "%s"|format(namespace|replace(".","::")) %} | 6 {%- set namespace_as_string = "%s"|format(namespace|replace(".","::")) %} |
| 7 | 7 |
| 8 {%- macro alloc_params(struct, params, message, serialization_context, | 8 {%- macro alloc_params(struct, params, message, serialization_context, |
| 9 description) %} | 9 description) %} |
| 10 ({{params}})->DecodePointers(); | |
| 11 ({{serialization_context}})->handles.Swap(({{message}})->mutable_handles()); | 10 ({{serialization_context}})->handles.Swap(({{message}})->mutable_handles()); |
| 12 bool success = true; | 11 bool success = true; |
| 13 {%- for param in struct.packed.packed_fields_in_ordinal_order %} | 12 {%- for param in struct.packed.packed_fields_in_ordinal_order %} |
| 14 {{param.field.kind|cpp_wrapper_type}} p_{{param.field.name}}{}; | 13 {{param.field.kind|cpp_wrapper_type}} p_{{param.field.name}}{}; |
| 15 {%- endfor %} | 14 {%- endfor %} |
| 16 {{struct.name}}DataView input_data_view({{params}}, | 15 {{struct.name}}DataView input_data_view({{params}}, |
| 17 {{serialization_context}}); | 16 {{serialization_context}}); |
| 18 {{struct_macros.deserialize(struct, "input_data_view", "p_%s", "success")}} | 17 {{struct_macros.deserialize(struct, "input_data_view", "p_%s", "success")}} |
| 19 if (!success) { | 18 if (!success) { |
| 20 mojo::internal::ValidationContext validation_context( | 19 mojo::internal::ValidationContext validation_context( |
| (...skipping 14 matching lines...) Expand all Loading... |
| 35 {%- endfor %} | 34 {%- endfor %} |
| 36 {%- endmacro %} | 35 {%- endmacro %} |
| 37 | 36 |
| 38 {%- macro build_message(struct, input_pattern, struct_display_name, | 37 {%- macro build_message(struct, input_pattern, struct_display_name, |
| 39 serialization_context) -%} | 38 serialization_context) -%} |
| 40 {{struct_macros.serialize(struct, struct_display_name, input_pattern, | 39 {{struct_macros.serialize(struct, struct_display_name, input_pattern, |
| 41 "params", "builder.buffer()", | 40 "params", "builder.buffer()", |
| 42 serialization_context)}} | 41 serialization_context)}} |
| 43 ({{serialization_context}})->handles.Swap( | 42 ({{serialization_context}})->handles.Swap( |
| 44 builder.message()->mutable_handles()); | 43 builder.message()->mutable_handles()); |
| 45 params->EncodePointers(); | |
| 46 | |
| 47 {%- endmacro %} | 44 {%- endmacro %} |
| 48 | 45 |
| 49 {#--- Begin #} | 46 {#--- Begin #} |
| 50 const char {{class_name}}::Name_[] = "{{namespace_as_string}}::{{class_name}}"; | 47 const char {{class_name}}::Name_[] = "{{namespace_as_string}}::{{class_name}}"; |
| 51 const uint32_t {{class_name}}::Version_; | 48 const uint32_t {{class_name}}::Version_; |
| 52 | 49 |
| 53 {#--- Constants #} | 50 {#--- Constants #} |
| 54 {%- for constant in interface.constants %} | 51 {%- for constant in interface.constants %} |
| 55 {%- if constant.kind|is_integral_kind %} | 52 {%- if constant.kind|is_integral_kind %} |
| 56 const {{constant.kind|cpp_pod_type}} {{interface.name}}::{{constant.name}}; | 53 const {{constant.kind|cpp_pod_type}} {{interface.name}}::{{constant.name}}; |
| (...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 break; | 462 break; |
| 466 } | 463 } |
| 467 | 464 |
| 468 // Unrecognized message. | 465 // Unrecognized message. |
| 469 ReportValidationError( | 466 ReportValidationError( |
| 470 &validation_context, | 467 &validation_context, |
| 471 mojo::internal::VALIDATION_ERROR_MESSAGE_HEADER_UNKNOWN_METHOD); | 468 mojo::internal::VALIDATION_ERROR_MESSAGE_HEADER_UNKNOWN_METHOD); |
| 472 return false; | 469 return false; |
| 473 } | 470 } |
| 474 {%- endif -%} | 471 {%- endif -%} |
| OLD | NEW |