OLD | NEW |
1 {%- macro declare_params(prefix, parameters) %} | 1 {%- macro declare_params(prefix, parameters) %} |
2 {%- for param in parameters -%} | 2 {%- for param in parameters -%} |
3 {{param.kind|cpp_wrapper_param_type}} {{prefix}}{{param.name}} | 3 {{param.kind|cpp_wrapper_param_type}} {{prefix}}{{param.name}} |
4 {%- if not loop.last %}, {% endif %} | 4 {%- if not loop.last %}, {% endif %} |
5 {%- endfor %} | 5 {%- endfor %} |
6 {%- endmacro %} | 6 {%- endmacro %} |
7 | 7 |
8 {%- macro declare_responder_params(prefix, parameters, for_blink) %} | 8 {%- macro declare_responder_params(prefix, parameters, for_blink, use_new_wrappe
r_types) %} |
9 {%- for param in parameters -%} | 9 {%- for param in parameters -%} |
10 {%- if (not param.kind|is_string_kind) or for_blink -%} | 10 {%- if (not param.kind|is_string_kind) or for_blink or |
| 11 use_new_wrapper_types -%} |
11 {{param.kind|cpp_wrapper_param_type}} {{prefix}}{{param.name}} | 12 {{param.kind|cpp_wrapper_param_type}} {{prefix}}{{param.name}} |
12 {%- else %} | 13 {%- else %} |
13 mojo::String {{prefix}}{{param.name}} | 14 mojo::String {{prefix}}{{param.name}} |
14 {%- endif %} | 15 {%- endif %} |
15 {%- if not loop.last %}, {% endif %} | 16 {%- if not loop.last %}, {% endif %} |
16 {%- endfor %} | 17 {%- endfor %} |
17 {%- endmacro %} | 18 {%- endmacro %} |
18 | 19 |
19 {%- macro declare_callback(method, for_blink) -%} | 20 {%- macro declare_callback(method, for_blink, use_new_wrapper_types) -%} |
20 base::Callback<void( | 21 base::Callback<void( |
21 {%- for param in method.response_parameters -%} | 22 {%- for param in method.response_parameters -%} |
22 {#- TODO(yzshen): For historical reasons, we use mojo::String here (instead of | 23 {#- TODO(yzshen): For historical reasons, we use mojo::String here (instead of |
23 const mojo::String&) inconsistently. Preserve the behavior temporarily. #} | 24 const mojo::String&) inconsistently. Preserve the behavior temporarily. #} |
24 {%- if (not param.kind|is_string_kind) or for_blink -%} | 25 {%- if (not param.kind|is_string_kind) or for_blink or |
| 26 use_new_wrapper_types -%} |
25 {{param.kind|cpp_wrapper_param_type}} | 27 {{param.kind|cpp_wrapper_param_type}} |
26 {%- else -%} | 28 {%- else -%} |
27 mojo::String | 29 mojo::String |
28 {%- endif %} | 30 {%- endif %} |
29 {%- if not loop.last %}, {% endif %} | 31 {%- if not loop.last %}, {% endif %} |
30 {%- endfor -%} | 32 {%- endfor -%} |
31 )> | 33 )> |
32 {%- endmacro -%} | 34 {%- endmacro -%} |
33 | 35 |
34 {%- macro declare_request_params(prefix, method) -%} | 36 {%- macro declare_request_params(prefix, method) -%} |
35 {{declare_params(prefix, method.parameters)}} | 37 {{declare_params(prefix, method.parameters)}} |
36 {%- if method.response_parameters != None -%} | 38 {%- if method.response_parameters != None -%} |
37 {%- if method.parameters %}, {% endif -%} | 39 {%- if method.parameters %}, {% endif -%} |
38 const {{method.name}}Callback& callback | 40 const {{method.name}}Callback& callback |
39 {%- endif -%} | 41 {%- endif -%} |
40 {%- endmacro -%} | 42 {%- endmacro -%} |
41 | 43 |
42 {%- macro declare_sync_method_params(prefix, method) -%} | 44 {%- macro declare_sync_method_params(prefix, method) -%} |
43 {{declare_params(prefix, method.parameters)}} | 45 {{declare_params(prefix, method.parameters)}} |
44 {%- if method.response_parameters %} | 46 {%- if method.response_parameters %} |
45 {%- if method.parameters %}, {% endif %} | 47 {%- if method.parameters %}, {% endif %} |
46 {%- for param in method.response_parameters -%} | 48 {%- for param in method.response_parameters -%} |
47 {{param.kind|cpp_wrapper_type}}* {{prefix}}{{param.name}} | 49 {{param.kind|cpp_wrapper_type}}* {{prefix}}{{param.name}} |
48 {%- if not loop.last %}, {% endif %} | 50 {%- if not loop.last %}, {% endif %} |
49 {%- endfor %} | 51 {%- endfor %} |
50 {%- endif -%} | 52 {%- endif -%} |
51 {%- endmacro -%} | 53 {%- endmacro -%} |
OLD | NEW |