| 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 {%- from "enum_macros.tmpl" import is_valid_enum_def %} | 3 {%- from "enum_macros.tmpl" import is_valid_enum_def %} |
| 4 {%- from "enum_macros.tmpl" import global_enum_operators_def %} | 4 {%- from "enum_macros.tmpl" import global_enum_operators_def %} |
| 5 | 5 |
| 6 {%- set class_name = interface.name %} | 6 {%- set class_name = interface.name %} |
| 7 {%- set proxy_name = interface.name ~ "Proxy" %} | 7 {%- set proxy_name = interface.name ~ "Proxy" %} |
| 8 {%- set namespace_as_string = "%s"|format(namespace|replace(".","::")) %} | |
| 9 | 8 |
| 10 {%- macro alloc_params(struct) %} | 9 {%- macro alloc_params(struct) %} |
| 11 {%- for param in struct.packed.packed_fields_in_ordinal_order %} | 10 {%- for param in struct.packed.packed_fields_in_ordinal_order %} |
| 12 {{param.field.kind|cpp_result_type}} p_{{param.field.name}} {}; | 11 {{param.field.kind|cpp_result_type}} p_{{param.field.name}} {}; |
| 13 {%- endfor %} | 12 {%- endfor %} |
| 14 {{struct_macros.deserialize(struct, "params", "p_%s")}} | 13 {{struct_macros.deserialize(struct, "params", "p_%s")}} |
| 15 {%- endmacro %} | 14 {%- endmacro %} |
| 16 | 15 |
| 17 {%- macro pass_params(parameters) %} | 16 {%- macro pass_params(parameters) %} |
| 18 {%- for param in parameters %} | 17 {%- for param in parameters %} |
| 19 {%- if param.kind|is_move_only_kind -%} | 18 {%- if param.kind|is_move_only_kind -%} |
| 20 p_{{param.name}}.Pass() | 19 p_{{param.name}}.Pass() |
| 21 {%- else -%} | 20 {%- else -%} |
| 22 p_{{param.name}} | 21 p_{{param.name}} |
| 23 {%- endif -%} | 22 {%- endif -%} |
| 24 {%- if not loop.last %}, {% endif %} | 23 {%- if not loop.last %}, {% endif %} |
| 25 {%- endfor %} | 24 {%- endfor %} |
| 26 {%- endmacro %} | 25 {%- endmacro %} |
| 27 | 26 |
| 28 {%- macro build_message(struct, struct_display_name) -%} | 27 {%- macro build_message(struct, struct_display_name) -%} |
| 29 {{struct_macros.serialize(struct, struct_display_name, "in_%s", "params", "bui
lder.buffer()", false)}} | 28 {{struct_macros.serialize(struct, struct_display_name, "in_%s", "params", "bui
lder.buffer()", false)}} |
| 30 params->EncodePointersAndHandles(builder.message()->mutable_handles()); | 29 params->EncodePointersAndHandles(builder.message()->mutable_handles()); |
| 31 {%- endmacro %} | 30 {%- endmacro %} |
| 32 | 31 |
| 33 {#--- Begin #} | 32 {#--- Begin #} |
| 34 MOJO_STATIC_CONST_MEMBER_DEFINITION const char {{class_name}}::Name_[] = "{{name
space_as_string}}::{{class_name}}"; | 33 {%- if interface.service_name %} |
| 34 MOJO_STATIC_CONST_MEMBER_DEFINITION const char {{class_name}}::Name_[] = "{{inte
rface.service_name}}"; |
| 35 {%- endif %} |
| 35 MOJO_STATIC_CONST_MEMBER_DEFINITION const uint32_t {{class_name}}::Version_; | 36 MOJO_STATIC_CONST_MEMBER_DEFINITION const uint32_t {{class_name}}::Version_; |
| 36 | 37 |
| 37 {#--- Constants #} | 38 {#--- Constants #} |
| 38 {%- for constant in interface.constants %} | 39 {%- for constant in interface.constants %} |
| 39 {%- if constant.kind|is_integral_kind %} | 40 {%- if constant.kind|is_integral_kind %} |
| 40 MOJO_STATIC_CONST_MEMBER_DEFINITION const {{constant.kind|cpp_pod_type}} {{inter
face.name}}::{{constant.name}}; | 41 MOJO_STATIC_CONST_MEMBER_DEFINITION const {{constant.kind|cpp_pod_type}} {{inter
face.name}}::{{constant.name}}; |
| 41 {%- else %} | 42 {%- else %} |
| 42 MOJO_STATIC_CONST_MEMBER_DEFINITION const {{constant.kind|cpp_pod_type}} {{inter
face.name}}::{{constant.name}} = {{constant|constant_value}}; | 43 MOJO_STATIC_CONST_MEMBER_DEFINITION const {{constant.kind|cpp_pod_type}} {{inter
face.name}}::{{constant.name}} = {{constant|constant_value}}; |
| 43 {%- endif %} | 44 {%- endif %} |
| 44 {%- endfor %} | 45 {%- endfor %} |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 default: | 328 default: |
| 328 break; | 329 break; |
| 329 } | 330 } |
| 330 | 331 |
| 331 // Unrecognized message. | 332 // Unrecognized message. |
| 332 ReportValidationError( | 333 ReportValidationError( |
| 333 mojo::internal::ValidationError::MESSAGE_HEADER_UNKNOWN_METHOD); | 334 mojo::internal::ValidationError::MESSAGE_HEADER_UNKNOWN_METHOD); |
| 334 return false; | 335 return false; |
| 335 } | 336 } |
| 336 {%- endif -%} | 337 {%- endif -%} |
| OLD | NEW |