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

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

Issue 1991463002: Mojo: Expose untyped associated endpoints through public API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 | « mojo/public/tools/bindings/generators/cpp_templates/struct_data_view_definition.tmpl ('k') | 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 {# TODO(yzshen): Make these templates more readable. #} 1 {# TODO(yzshen): Make these templates more readable. #}
2 2
3 {# Computes the serialized size for the specified struct. 3 {# Computes the serialized size for the specified struct.
4 |struct| is the struct definition. 4 |struct| is the struct definition.
5 |input_field_pattern| should be a pattern that contains one string 5 |input_field_pattern| should be a pattern that contains one string
6 placeholder, for example, "input->%s", "p_%s". The placeholder will be 6 placeholder, for example, "input->%s", "p_%s". The placeholder will be
7 substituted with struct field names to refer to the input fields. 7 substituted with struct field names to refer to the input fields.
8 |context| is the name of the serialization context. 8 |context| is the name of the serialization context.
9 |input_may_be_temp| indicates whether any input may be temporary obejcts. 9 |input_may_be_temp| indicates whether any input may be temporary obejcts.
10 We need to assign temporary objects to local variables before passing it to 10 We need to assign temporary objects to local variables before passing it to
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 !{{output}}->{{name}}.is_valid(), 116 !{{output}}->{{name}}.is_valid(),
117 {%- endif %} 117 {%- endif %}
118 mojo::internal::VALIDATION_ERROR_UNEXPECTED_INVALID_HANDLE, 118 mojo::internal::VALIDATION_ERROR_UNEXPECTED_INVALID_HANDLE,
119 "invalid {{name}} in {{struct_display_name}}"); 119 "invalid {{name}} in {{struct_display_name}}");
120 {%- endif %} 120 {%- endif %}
121 {%- elif kind|is_associated_kind %} 121 {%- elif kind|is_associated_kind %}
122 // TODO(yzshen): add some DCHECKs for non-nullable, is_local, correct router, etc. 122 // TODO(yzshen): add some DCHECKs for non-nullable, is_local, correct router, etc.
123 {%- if kind|is_associated_interface_kind %} 123 {%- if kind|is_associated_interface_kind %}
124 mojo::internal::AssociatedInterfacePtrInfoToData(std::move({{input_field}}), & {{output}}->{{name}}); 124 mojo::internal::AssociatedInterfacePtrInfoToData(std::move({{input_field}}), & {{output}}->{{name}});
125 {%- else %} 125 {%- else %}
126 {{output}}->{{name}} = mojo::internal::AssociatedInterfaceRequestHelper::PassH andle(&{{input_field}}).release(); 126 {{output}}->{{name}} = {{input_field}}.PassHandle().release();
127 {%- endif %} 127 {%- endif %}
128 {%- elif kind|is_enum_kind %} 128 {%- elif kind|is_enum_kind %}
129 {{output}}->{{name}} = static_cast<int32_t>({{input_field}}); 129 {{output}}->{{name}} = static_cast<int32_t>({{input_field}});
130 {%- else %} 130 {%- else %}
131 {{output}}->{{name}} = {{input_field}}; 131 {{output}}->{{name}} = {{input_field}};
132 {%- endif %} 132 {%- endif %}
133 {%- endfor %} 133 {%- endfor %}
134 {%- endmacro -%} 134 {%- endmacro -%}
135 135
136 {# Deserializes the specified struct. 136 {# Deserializes the specified struct.
(...skipping 19 matching lines...) Expand all
156 if (!{{input}}.Read{{name|under_to_camel}}(&{{output_field}})) 156 if (!{{input}}.Read{{name|under_to_camel}}(&{{output_field}}))
157 {{success}} = false; 157 {{success}} = false;
158 {%- elif kind|is_interface_kind or kind|is_any_handle_kind or 158 {%- elif kind|is_interface_kind or kind|is_any_handle_kind or
159 kind|is_associated_kind %} 159 kind|is_associated_kind %}
160 {{output_field}} = {{input}}.Take{{name|under_to_camel}}(); 160 {{output_field}} = {{input}}.Take{{name|under_to_camel}}();
161 {%- else %} 161 {%- else %}
162 {{output_field}} = {{input}}.{{name}}(); 162 {{output_field}} = {{input}}.{{name}}();
163 {%- endif %} 163 {%- endif %}
164 {%- endfor %} 164 {%- endfor %}
165 {%- endmacro %} 165 {%- endmacro %}
OLDNEW
« no previous file with comments | « mojo/public/tools/bindings/generators/cpp_templates/struct_data_view_definition.tmpl ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698