| 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 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 uint64_t request_id, | 218 uint64_t request_id, |
| 219 bool is_sync, | 219 bool is_sync, |
| 220 mojo::MessageReceiverWithStatus* responder, | 220 mojo::MessageReceiverWithStatus* responder, |
| 221 scoped_refptr<mojo::internal::MultiplexRouter> router) | 221 scoped_refptr<mojo::internal::MultiplexRouter> router) |
| 222 : request_id_(request_id), | 222 : request_id_(request_id), |
| 223 is_sync_(is_sync), | 223 is_sync_(is_sync), |
| 224 responder_(responder), | 224 responder_(responder), |
| 225 serialization_context_(std::move(router)) { | 225 serialization_context_(std::move(router)) { |
| 226 } | 226 } |
| 227 | 227 |
| 228 void Run({{interface_macros.declare_params("in_", method.response_parameters)}
}) const override; | 228 void Run({{interface_macros.declare_params("in_", method.response_parameters)}
}) override; |
| 229 | 229 |
| 230 private: | 230 private: |
| 231 uint64_t request_id_; | 231 uint64_t request_id_; |
| 232 bool is_sync_; | 232 bool is_sync_; |
| 233 mutable mojo::MessageReceiverWithStatus* responder_; | 233 mojo::MessageReceiverWithStatus* responder_; |
| 234 // TODO(yzshen): maybe I should use a ref to the original one? | 234 // TODO(yzshen): maybe I should use a ref to the original one? |
| 235 mutable mojo::internal::SerializationContext serialization_context_; | 235 mojo::internal::SerializationContext serialization_context_; |
| 236 DISALLOW_COPY_AND_ASSIGN({{class_name}}_{{method.name}}_ProxyToResponder); | 236 DISALLOW_COPY_AND_ASSIGN({{class_name}}_{{method.name}}_ProxyToResponder); |
| 237 }; | 237 }; |
| 238 void {{class_name}}_{{method.name}}_ProxyToResponder::Run( | 238 void {{class_name}}_{{method.name}}_ProxyToResponder::Run( |
| 239 {{interface_macros.declare_params("in_", method.response_parameters)}}) cons
t { | 239 {{interface_macros.declare_params("in_", method.response_parameters)}}) { |
| 240 {{struct_macros.get_serialized_size(response_params_struct, "in_%s", | 240 {{struct_macros.get_serialized_size(response_params_struct, "in_%s", |
| 241 "&serialization_context_")}} | 241 "&serialization_context_")}} |
| 242 mojo::internal::ResponseMessageBuilder builder( | 242 mojo::internal::ResponseMessageBuilder builder( |
| 243 {{message_name}}, size, request_id_, | 243 {{message_name}}, size, request_id_, |
| 244 is_sync_ ? mojo::internal::kMessageIsSync : 0); | 244 is_sync_ ? mojo::internal::kMessageIsSync : 0); |
| 245 {{build_message(response_params_struct, "in_%s", params_description, | 245 {{build_message(response_params_struct, "in_%s", params_description, |
| 246 "&serialization_context_")}} | 246 "&serialization_context_")}} |
| 247 bool ok = responder_->Accept(builder.message()); | 247 bool ok = responder_->Accept(builder.message()); |
| 248 ALLOW_UNUSED_LOCAL(ok); | 248 ALLOW_UNUSED_LOCAL(ok); |
| 249 // TODO(darin): !ok returned here indicates a malformed message, and that may | 249 // TODO(darin): !ok returned here indicates a malformed message, and that may |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 default: | 403 default: |
| 404 break; | 404 break; |
| 405 } | 405 } |
| 406 | 406 |
| 407 // Unrecognized message. | 407 // Unrecognized message. |
| 408 ReportValidationError( | 408 ReportValidationError( |
| 409 mojo::internal::VALIDATION_ERROR_MESSAGE_HEADER_UNKNOWN_METHOD); | 409 mojo::internal::VALIDATION_ERROR_MESSAGE_HEADER_UNKNOWN_METHOD); |
| 410 return false; | 410 return false; |
| 411 } | 411 } |
| 412 {%- endif -%} | 412 {%- endif -%} |
| OLD | NEW |