| 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 %} | |
| 4 | 3 |
| 5 {%- set class_name = interface.name %} | 4 {%- set class_name = interface.name %} |
| 6 {%- set proxy_name = interface.name ~ "Proxy" %} | 5 {%- set proxy_name = interface.name ~ "Proxy" %} |
| 7 {%- set namespace_as_string = "%s"|format(namespace|replace(".","::")) %} | 6 {%- set namespace_as_string = "%s"|format(namespace|replace(".","::")) %} |
| 8 | 7 |
| 9 {%- macro alloc_params(struct, serialization_context) %} | 8 {%- macro alloc_params(struct, serialization_context) %} |
| 10 bool success = true; | 9 bool success = true; |
| 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_wrapper_type}} p_{{param.field.name}}{}; | 11 {{param.field.kind|cpp_wrapper_type}} p_{{param.field.name}}{}; |
| 13 {%- endfor %} | 12 {%- endfor %} |
| (...skipping 24 matching lines...) Expand all Loading... |
| 38 | 37 |
| 39 {#--- Constants #} | 38 {#--- Constants #} |
| 40 {%- for constant in interface.constants %} | 39 {%- for constant in interface.constants %} |
| 41 {%- if constant.kind|is_integral_kind %} | 40 {%- if constant.kind|is_integral_kind %} |
| 42 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}}; |
| 43 {%- else %} | 42 {%- else %} |
| 44 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}}; |
| 45 {%- endif %} | 44 {%- endif %} |
| 46 {%- endfor %} | 45 {%- endfor %} |
| 47 | 46 |
| 48 {#--- Enums #} | |
| 49 {%- for enum in interface.enums %} | |
| 50 {{is_valid_enum_def(enum, class_name=interface.name)|indent(2)}} | |
| 51 {%- endfor %} | |
| 52 | |
| 53 {#--- ForwardToCallback definition #} | 47 {#--- ForwardToCallback definition #} |
| 54 {%- for method in interface.methods -%} | 48 {%- for method in interface.methods -%} |
| 55 {%- if method.response_parameters != None %} | 49 {%- if method.response_parameters != None %} |
| 56 class {{class_name}}_{{method.name}}_ForwardToCallback | 50 class {{class_name}}_{{method.name}}_ForwardToCallback |
| 57 : public mojo::MessageReceiver { | 51 : public mojo::MessageReceiver { |
| 58 public: | 52 public: |
| 59 {{class_name}}_{{method.name}}_ForwardToCallback( | 53 {{class_name}}_{{method.name}}_ForwardToCallback( |
| 60 const {{class_name}}::{{method.name}}Callback& callback, | 54 const {{class_name}}::{{method.name}}Callback& callback, |
| 61 scoped_refptr<mojo::internal::MultiplexRouter> router) | 55 scoped_refptr<mojo::internal::MultiplexRouter> router) |
| 62 : callback_(callback), serialization_context_(std::move(router)) { | 56 : callback_(callback), serialization_context_(std::move(router)) { |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 default: | 314 default: |
| 321 break; | 315 break; |
| 322 } | 316 } |
| 323 | 317 |
| 324 // Unrecognized message. | 318 // Unrecognized message. |
| 325 ReportValidationError( | 319 ReportValidationError( |
| 326 mojo::internal::VALIDATION_ERROR_MESSAGE_HEADER_UNKNOWN_METHOD); | 320 mojo::internal::VALIDATION_ERROR_MESSAGE_HEADER_UNKNOWN_METHOD); |
| 327 return false; | 321 return false; |
| 328 } | 322 } |
| 329 {%- endif -%} | 323 {%- endif -%} |
| OLD | NEW |