| 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(); | 10 ({{params}})->DecodePointers(); |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 {%- set params_struct = method.param_struct %} | 158 {%- set params_struct = method.param_struct %} |
| 159 {%- set params_description = | 159 {%- set params_description = |
| 160 "%s.%s request"|format(interface.name, method.name) %} | 160 "%s.%s request"|format(interface.name, method.name) %} |
| 161 {%- if method.sync %} | 161 {%- if method.sync %} |
| 162 bool {{proxy_name}}::{{method.name}}( | 162 bool {{proxy_name}}::{{method.name}}( |
| 163 {{interface_macros.declare_sync_method_params("param_", method)}}) { | 163 {{interface_macros.declare_sync_method_params("param_", method)}}) { |
| 164 {{struct_macros.get_serialized_size(params_struct, "param_%s", | 164 {{struct_macros.get_serialized_size(params_struct, "param_%s", |
| 165 "&serialization_context_")}} | 165 "&serialization_context_")}} |
| 166 | 166 |
| 167 mojo::internal::RequestMessageBuilder builder({{message_name}}, size, | 167 mojo::internal::RequestMessageBuilder builder({{message_name}}, size, |
| 168 mojo::internal::kMessageIsSync); | 168 mojo::Message::kFlagIsSync); |
| 169 | 169 |
| 170 {{build_message(params_struct, "param_%s", params_description, | 170 {{build_message(params_struct, "param_%s", params_description, |
| 171 "&serialization_context_")}} | 171 "&serialization_context_")}} |
| 172 | 172 |
| 173 bool result = false; | 173 bool result = false; |
| 174 mojo::MessageReceiver* responder = | 174 mojo::MessageReceiver* responder = |
| 175 new {{class_name}}_{{method.name}}_HandleSyncResponse( | 175 new {{class_name}}_{{method.name}}_HandleSyncResponse( |
| 176 serialization_context_.group_controller, &result | 176 serialization_context_.group_controller, &result |
| 177 {%- for param in method.response_parameters -%} | 177 {%- for param in method.response_parameters -%} |
| 178 , param_{{param.name}} | 178 , param_{{param.name}} |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 DISALLOW_COPY_AND_ASSIGN({{class_name}}_{{method.name}}_ProxyToResponder); | 279 DISALLOW_COPY_AND_ASSIGN({{class_name}}_{{method.name}}_ProxyToResponder); |
| 280 }; | 280 }; |
| 281 | 281 |
| 282 void {{class_name}}_{{method.name}}_ProxyToResponder::Run( | 282 void {{class_name}}_{{method.name}}_ProxyToResponder::Run( |
| 283 {{interface_macros.declare_responder_params( | 283 {{interface_macros.declare_responder_params( |
| 284 "in_", method.response_parameters, for_blink)}}) { | 284 "in_", method.response_parameters, for_blink)}}) { |
| 285 {{struct_macros.get_serialized_size(response_params_struct, "in_%s", | 285 {{struct_macros.get_serialized_size(response_params_struct, "in_%s", |
| 286 "&serialization_context_")}} | 286 "&serialization_context_")}} |
| 287 mojo::internal::ResponseMessageBuilder builder( | 287 mojo::internal::ResponseMessageBuilder builder( |
| 288 {{message_name}}, size, request_id_, | 288 {{message_name}}, size, request_id_, |
| 289 is_sync_ ? mojo::internal::kMessageIsSync : 0); | 289 is_sync_ ? mojo::Message::kFlagIsSync : 0); |
| 290 {{build_message(response_params_struct, "in_%s", params_description, | 290 {{build_message(response_params_struct, "in_%s", params_description, |
| 291 "&serialization_context_")}} | 291 "&serialization_context_")}} |
| 292 bool ok = responder_->Accept(builder.message()); | 292 bool ok = responder_->Accept(builder.message()); |
| 293 ALLOW_UNUSED_LOCAL(ok); | 293 ALLOW_UNUSED_LOCAL(ok); |
| 294 // TODO(darin): !ok returned here indicates a malformed message, and that may | 294 // TODO(darin): !ok returned here indicates a malformed message, and that may |
| 295 // be good reason to close the connection. However, we don't have a way to do | 295 // be good reason to close the connection. However, we don't have a way to do |
| 296 // that from here. We should add a way. | 296 // that from here. We should add a way. |
| 297 delete responder_; | 297 delete responder_; |
| 298 responder_ = nullptr; | 298 responder_ = nullptr; |
| 299 } | 299 } |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 internal::{{class_name}}_{{method.name}}_Params_Data* params = | 351 internal::{{class_name}}_{{method.name}}_Params_Data* params = |
| 352 reinterpret_cast<internal::{{class_name}}_{{method.name}}_Params_Data*
>( | 352 reinterpret_cast<internal::{{class_name}}_{{method.name}}_Params_Data*
>( |
| 353 message->mutable_payload()); | 353 message->mutable_payload()); |
| 354 | 354 |
| 355 {{alloc_params(method.param_struct, "params", "message", | 355 {{alloc_params(method.param_struct, "params", "message", |
| 356 "&serialization_context_", "{{class_name}}::{{method.name}}")| | 356 "&serialization_context_", "{{class_name}}::{{method.name}}")| |
| 357 indent(4)}} | 357 indent(4)}} |
| 358 {{class_name}}::{{method.name}}Callback callback = | 358 {{class_name}}::{{method.name}}Callback callback = |
| 359 {{class_name}}_{{method.name}}_ProxyToResponder::CreateCallback( | 359 {{class_name}}_{{method.name}}_ProxyToResponder::CreateCallback( |
| 360 message->request_id(), | 360 message->request_id(), |
| 361 message->has_flag(mojo::internal::kMessageIsSync), | 361 message->has_flag(mojo::Message::kFlagIsSync), |
| 362 responder, | 362 responder, |
| 363 serialization_context_.group_controller); | 363 serialization_context_.group_controller); |
| 364 // A null |sink_| means no implementation was bound. | 364 // A null |sink_| means no implementation was bound. |
| 365 assert(sink_); | 365 assert(sink_); |
| 366 TRACE_EVENT0("mojom", "{{class_name}}::{{method.name}}"); | 366 TRACE_EVENT0("mojom", "{{class_name}}::{{method.name}}"); |
| 367 sink_->{{method.name}}( | 367 sink_->{{method.name}}( |
| 368 {%- if method.parameters -%}{{pass_params(method.parameters)}}, {% endif -%}call
back); | 368 {%- if method.parameters -%}{{pass_params(method.parameters)}}, {% endif -%}call
back); |
| 369 return true; | 369 return true; |
| 370 {%- else %} | 370 {%- else %} |
| 371 break; | 371 break; |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 break; | 465 break; |
| 466 } | 466 } |
| 467 | 467 |
| 468 // Unrecognized message. | 468 // Unrecognized message. |
| 469 ReportValidationError( | 469 ReportValidationError( |
| 470 &validation_context, | 470 &validation_context, |
| 471 mojo::internal::VALIDATION_ERROR_MESSAGE_HEADER_UNKNOWN_METHOD); | 471 mojo::internal::VALIDATION_ERROR_MESSAGE_HEADER_UNKNOWN_METHOD); |
| 472 return false; | 472 return false; |
| 473 } | 473 } |
| 474 {%- endif -%} | 474 {%- endif -%} |
| OLD | NEW |