Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(561)

Side by Side Diff: mojo/public/tools/bindings/generators/cpp_templates/interface_definition.tmpl

Issue 921223002: Cpp bindings: Return false from Validator::Accept() on unrecognized message or invalid flags (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 {%- set class_name = interface.name %} 3 {%- set class_name = interface.name %}
4 {%- set proxy_name = interface.name ~ "Proxy" %} 4 {%- set proxy_name = interface.name ~ "Proxy" %}
5 {%- set namespace_as_string = "%s"|format(namespace|replace(".","::")) %} 5 {%- set namespace_as_string = "%s"|format(namespace|replace(".","::")) %}
6 6
7 {%- macro alloc_params(struct) %} 7 {%- macro alloc_params(struct) %}
8 {%- for param in struct.packed.packed_fields_in_ordinal_order %} 8 {%- for param in struct.packed.packed_fields_in_ordinal_order %}
9 {{param.field.kind|cpp_result_type}} p_{{param.field.name}}{}; 9 {{param.field.kind|cpp_result_type}} p_{{param.field.name}}{};
10 {%- endfor %} 10 {%- endfor %}
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 mojo::internal::BoundsChecker bounds_checker( 266 mojo::internal::BoundsChecker bounds_checker(
267 message->payload(), message->payload_num_bytes(), 267 message->payload(), message->payload_num_bytes(),
268 message->handles()->size()); 268 message->handles()->size());
269 if (!internal::{{class_name}}_{{method.name}}_ResponseParams_Data::Validat e( 269 if (!internal::{{class_name}}_{{method.name}}_ResponseParams_Data::Validat e(
270 message->payload(), &bounds_checker)) { 270 message->payload(), &bounds_checker)) {
271 return false; 271 return false;
272 } 272 }
273 break; 273 break;
274 } 274 }
275 {%- endfor %} 275 {%- endfor %}
276 default: {
277 // Unrecognized message.
278 return false;
yzshen1 2015/02/17 19:39:35 You also need to do the same for RequestValidator.
rudominer 2015/02/23 19:12:22 Done
279 }
276 } 280 }
277 {%- endif %} 281 {%- endif %}
278 282
279 assert(sink_); 283 assert(sink_);
280 return sink_->Accept(message); 284 return sink_->Accept(message);
281 } 285 }
282 {%- endif -%} 286 {%- endif -%}
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698