OLD | NEW |
1 {%- import "interface_macros.tmpl" as interface_macros %} | 1 {%- import "interface_macros.tmpl" as interface_macros %} |
2 {%- set class_name = interface.name %} | 2 {%- set class_name = interface.name %} |
3 {%- set proxy_name = interface.name ~ "Proxy" %} | 3 {%- set proxy_name = interface.name ~ "Proxy" %} |
4 {%- set namespace_as_string = "%s"|format(namespace|replace(".","::")) %} | 4 {%- set namespace_as_string = "%s"|format(namespace|replace(".","::")) %} |
5 | 5 |
6 {%- macro alloc_params(parameters) %} | 6 {%- macro alloc_params(parameters) %} |
7 {%- for param in parameters %} | 7 {%- for param in parameters %} |
8 {%- if param.kind|is_object_kind %} | 8 {%- if param.kind|is_object_kind %} |
9 {{param.kind|cpp_result_type}} p{{loop.index}}; | 9 {{param.kind|cpp_result_type}} p{{loop.index}}; |
10 Deserialize_(params->{{param.name}}.ptr, &p{{loop.index}}); | 10 Deserialize_(params->{{param.name}}.ptr, &p{{loop.index}}); |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 {#--- ForwardToCallback definition #} | 97 {#--- ForwardToCallback definition #} |
98 {%- for method in interface.methods -%} | 98 {%- for method in interface.methods -%} |
99 {%- if method.response_parameters != None %} | 99 {%- if method.response_parameters != None %} |
100 class {{class_name}}_{{method.name}}_ForwardToCallback | 100 class {{class_name}}_{{method.name}}_ForwardToCallback |
101 : public mojo::MessageReceiver { | 101 : public mojo::MessageReceiver { |
102 public: | 102 public: |
103 {{class_name}}_{{method.name}}_ForwardToCallback( | 103 {{class_name}}_{{method.name}}_ForwardToCallback( |
104 const {{interface_macros.declare_callback(method)}}& callback) | 104 const {{interface_macros.declare_callback(method)}}& callback) |
105 : callback_(callback) { | 105 : callback_(callback) { |
106 } | 106 } |
107 virtual bool Accept(mojo::Message* message) MOJO_OVERRIDE; | 107 virtual bool Accept(mojo::Message* message) override; |
108 private: | 108 private: |
109 {{interface_macros.declare_callback(method)}} callback_; | 109 {{interface_macros.declare_callback(method)}} callback_; |
110 MOJO_DISALLOW_COPY_AND_ASSIGN({{class_name}}_{{method.name}}_ForwardToCallback
); | 110 MOJO_DISALLOW_COPY_AND_ASSIGN({{class_name}}_{{method.name}}_ForwardToCallback
); |
111 }; | 111 }; |
112 bool {{class_name}}_{{method.name}}_ForwardToCallback::Accept( | 112 bool {{class_name}}_{{method.name}}_ForwardToCallback::Accept( |
113 mojo::Message* message) { | 113 mojo::Message* message) { |
114 internal::{{class_name}}_{{method.name}}_ResponseParams_Data* params = | 114 internal::{{class_name}}_{{method.name}}_ResponseParams_Data* params = |
115 reinterpret_cast<internal::{{class_name}}_{{method.name}}_ResponseParams_D
ata*>( | 115 reinterpret_cast<internal::{{class_name}}_{{method.name}}_ResponseParams_D
ata*>( |
116 message->mutable_payload()); | 116 message->mutable_payload()); |
117 | 117 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 delete responder_; | 177 delete responder_; |
178 } | 178 } |
179 | 179 |
180 {{class_name}}_{{method.name}}_ProxyToResponder( | 180 {{class_name}}_{{method.name}}_ProxyToResponder( |
181 uint64_t request_id, | 181 uint64_t request_id, |
182 mojo::MessageReceiver* responder) | 182 mojo::MessageReceiver* responder) |
183 : request_id_(request_id), | 183 : request_id_(request_id), |
184 responder_(responder) { | 184 responder_(responder) { |
185 } | 185 } |
186 | 186 |
187 virtual void Run({{interface_macros.declare_params("in_", method.response_para
meters)}}) const MOJO_OVERRIDE; | 187 virtual void Run({{interface_macros.declare_params("in_", method.response_para
meters)}}) const override; |
188 | 188 |
189 private: | 189 private: |
190 uint64_t request_id_; | 190 uint64_t request_id_; |
191 mutable mojo::MessageReceiver* responder_; | 191 mutable mojo::MessageReceiver* responder_; |
192 MOJO_DISALLOW_COPY_AND_ASSIGN({{class_name}}_{{method.name}}_ProxyToResponder)
; | 192 MOJO_DISALLOW_COPY_AND_ASSIGN({{class_name}}_{{method.name}}_ProxyToResponder)
; |
193 }; | 193 }; |
194 void {{class_name}}_{{method.name}}_ProxyToResponder::Run( | 194 void {{class_name}}_{{method.name}}_ProxyToResponder::Run( |
195 {{interface_macros.declare_params("in_", method.response_parameters)}}) cons
t { | 195 {{interface_macros.declare_params("in_", method.response_parameters)}}) cons
t { |
196 {{compute_payload_size(params_name, method.response_parameters)}} | 196 {{compute_payload_size(params_name, method.response_parameters)}} |
197 mojo::internal::ResponseMessageBuilder builder( | 197 mojo::internal::ResponseMessageBuilder builder( |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 } | 325 } |
326 break; | 326 break; |
327 } | 327 } |
328 {%- endfor %} | 328 {%- endfor %} |
329 } | 329 } |
330 {%- endif %} | 330 {%- endif %} |
331 | 331 |
332 return sink_->Accept(message); | 332 return sink_->Accept(message); |
333 } | 333 } |
334 {%- endif -%} | 334 {%- endif -%} |
OLD | NEW |