| 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, serialization_context) %} | 8 {%- macro alloc_params(struct, serialization_context) %} |
| 9 bool success = true; | 9 bool success = true; |
| 10 {%- for param in struct.packed.packed_fields_in_ordinal_order %} | 10 {%- for param in struct.packed.packed_fields_in_ordinal_order %} |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 {%- if method.response_parameters != None %} | 193 {%- if method.response_parameters != None %} |
| 194 {%- set message_name = | 194 {%- set message_name = |
| 195 "internal::k%s_%s_Name"|format(interface.name, method.name) %} | 195 "internal::k%s_%s_Name"|format(interface.name, method.name) %} |
| 196 {%- set response_params_struct = method.response_param_struct %} | 196 {%- set response_params_struct = method.response_param_struct %} |
| 197 {%- set params_description = | 197 {%- set params_description = |
| 198 "%s.%s response"|format(interface.name, method.name) %} | 198 "%s.%s response"|format(interface.name, method.name) %} |
| 199 class {{class_name}}_{{method.name}}_ProxyToResponder | 199 class {{class_name}}_{{method.name}}_ProxyToResponder |
| 200 : public {{class_name}}::{{method.name}}Callback::Runnable { | 200 : public {{class_name}}::{{method.name}}Callback::Runnable { |
| 201 public: | 201 public: |
| 202 ~{{class_name}}_{{method.name}}_ProxyToResponder() override { | 202 ~{{class_name}}_{{method.name}}_ProxyToResponder() override { |
| 203 // Is the Mojo application destroying the callback without running it | 203 #if DCHECK_IS_ON() |
| 204 // and without first closing the pipe? | 204 if (responder_) { |
| 205 bool callback_was_dropped = responder_ && responder_->IsValid(); | 205 // Is the Mojo application destroying the callback without running it |
| 206 // and without first closing the pipe? |
| 207 responder_->DCheckInvalid("The callback passed to " |
| 208 "{{class_name}}::{{method.name}}({%- if method.parameters -%}{{pass_pa
rams(method.parameters)}}, {% endif -%}callback) " |
| 209 "was never run."); |
| 210 } |
| 211 #endif |
| 206 // If the Callback was dropped then deleting the responder will close | 212 // If the Callback was dropped then deleting the responder will close |
| 207 // the pipe so the calling application knows to stop waiting for a reply. | 213 // the pipe so the calling application knows to stop waiting for a reply. |
| 208 delete responder_; | 214 delete responder_; |
| 209 DCHECK(!callback_was_dropped) << "The callback passed to " | |
| 210 "{{class_name}}::{{method.name}}({%- if method.parameters -%}{{pass_para
ms(method.parameters)}}, {% endif -%}callback) " | |
| 211 "was never run."; | |
| 212 } | 215 } |
| 213 | 216 |
| 214 {{class_name}}_{{method.name}}_ProxyToResponder( | 217 {{class_name}}_{{method.name}}_ProxyToResponder( |
| 215 uint64_t request_id, | 218 uint64_t request_id, |
| 216 bool is_sync, | 219 bool is_sync, |
| 217 mojo::MessageReceiverWithStatus* responder, | 220 mojo::MessageReceiverWithStatus* responder, |
| 218 scoped_refptr<mojo::internal::MultiplexRouter> router) | 221 scoped_refptr<mojo::internal::MultiplexRouter> router) |
| 219 : request_id_(request_id), | 222 : request_id_(request_id), |
| 220 is_sync_(is_sync), | 223 is_sync_(is_sync), |
| 221 responder_(responder), | 224 responder_(responder), |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 default: | 403 default: |
| 401 break; | 404 break; |
| 402 } | 405 } |
| 403 | 406 |
| 404 // Unrecognized message. | 407 // Unrecognized message. |
| 405 ReportValidationError( | 408 ReportValidationError( |
| 406 mojo::internal::VALIDATION_ERROR_MESSAGE_HEADER_UNKNOWN_METHOD); | 409 mojo::internal::VALIDATION_ERROR_MESSAGE_HEADER_UNKNOWN_METHOD); |
| 407 return false; | 410 return false; |
| 408 } | 411 } |
| 409 {%- endif -%} | 412 {%- endif -%} |
| OLD | NEW |