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

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

Issue 1751563002: Mojo C++ bindings: support mapping mojo string to WTF::String. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sync & rebase Created 4 years, 9 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
OLDNEW
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_const_wrapper_type}} {{prefix}}{{param.name}} 3 {{param.kind|cpp_const_wrapper_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_callback(method) -%} 8 {%- macro declare_callback(method, for_blink) -%}
9 mojo::Callback<void( 9 mojo::Callback<void(
10 {%- for param in method.response_parameters -%} 10 {%- for param in method.response_parameters -%}
11 {#- TODO(yzshen): Previously |cpp_result_type| is used here incorrectly. 11 {#- TODO(yzshen): Previously |cpp_result_type| is used here incorrectly.
12 The outcome is we will use mojo::String instead of const mojo::String&. 12 The outcome is we will use mojo::String instead of const mojo::String&.
13 Preserve the behavior temporarily. #} 13 Preserve the behavior temporarily. #}
14 {%- if not param.kind|is_string_kind -%} 14 {%- if (not param.kind|is_string_kind) or for_blink -%}
15 {{param.kind|cpp_const_wrapper_type}} 15 {{param.kind|cpp_const_wrapper_type}}
16 {%- else -%} 16 {%- else -%}
17 mojo::String 17 mojo::String
18 {%- endif %} 18 {%- endif %}
19 {%- if not loop.last %}, {% endif %} 19 {%- if not loop.last %}, {% endif %}
20 {%- endfor -%} 20 {%- endfor -%}
21 )> 21 )>
22 {%- endmacro -%} 22 {%- endmacro -%}
23 23
24 {%- macro declare_request_params(prefix, method) -%} 24 {%- macro declare_request_params(prefix, method) -%}
25 {{declare_params(prefix, method.parameters)}} 25 {{declare_params(prefix, method.parameters)}}
26 {%- if method.response_parameters != None -%} 26 {%- if method.response_parameters != None -%}
27 {%- if method.parameters %}, {% endif -%} 27 {%- if method.parameters %}, {% endif -%}
28 const {{method.name}}Callback& callback 28 const {{method.name}}Callback& callback
29 {%- endif -%} 29 {%- endif -%}
30 {%- endmacro -%} 30 {%- endmacro -%}
31 31
32 {%- macro declare_sync_method_params(prefix, method) -%} 32 {%- macro declare_sync_method_params(prefix, method) -%}
33 {{declare_params(prefix, method.parameters)}} 33 {{declare_params(prefix, method.parameters)}}
34 {%- if method.response_parameters %} 34 {%- if method.response_parameters %}
35 {%- if method.parameters %}, {% endif %} 35 {%- if method.parameters %}, {% endif %}
36 {%- for param in method.response_parameters -%} 36 {%- for param in method.response_parameters -%}
37 {{param.kind|cpp_wrapper_type}}* {{prefix}}{{param.name}} 37 {{param.kind|cpp_wrapper_type}}* {{prefix}}{{param.name}}
38 {%- if not loop.last %}, {% endif %} 38 {%- if not loop.last %}, {% endif %}
39 {%- endfor %} 39 {%- endfor %}
40 {%- endif -%} 40 {%- endif -%}
41 {%- endmacro -%} 41 {%- endmacro -%}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698