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

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

Issue 2225673002: Support exporting Mojo bindings for the component build. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix win_clang Created 4 years, 4 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 {%- import "struct_macros.tmpl" as struct_macros %} 1 {%- import "struct_macros.tmpl" as struct_macros %}
2 {%- set mojom_type = struct|get_qualified_name_for_kind %} 2 {%- set mojom_type = struct|get_qualified_name_for_kind %}
3 {%- set data_type = struct|get_qualified_name_for_kind(internal=True) %} 3 {%- set data_type = struct|get_qualified_name_for_kind(internal=True) %}
4 4
5 template <> 5 template <>
6 struct StructTraits<{{mojom_type}}, {{mojom_type}}Ptr> { 6 struct {{export_attribute}} StructTraits<{{mojom_type}}, {{mojom_type}}Ptr> {
7 static bool IsNull(const {{mojom_type}}Ptr& input) { return !input; } 7 static bool IsNull(const {{mojom_type}}Ptr& input) { return !input; }
8 static void SetToNull({{mojom_type}}Ptr* output) { output->reset(); } 8 static void SetToNull({{mojom_type}}Ptr* output) { output->reset(); }
9 9
10 {%- for field in struct.fields %} 10 {%- for field in struct.fields %}
11 {%- set return_ref = field.kind|is_object_kind or 11 {%- set return_ref = field.kind|is_object_kind or
12 field.kind|is_any_handle_or_interface_kind %} 12 field.kind|is_any_handle_or_interface_kind %}
13 {%- if return_ref %} 13 {%- if return_ref %}
14 static decltype({{mojom_type}}::{{field.name}})& {{field.name}}( 14 static decltype({{mojom_type}}::{{field.name}})& {{field.name}}(
15 {{mojom_type}}Ptr& input) { 15 {{mojom_type}}Ptr& input) {
16 return input->{{field.name}}; 16 return input->{{field.name}};
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 SerializationContext* context) { 72 SerializationContext* context) {
73 if (!input) 73 if (!input)
74 return CallSetToNullIfExists<Traits>(output); 74 return CallSetToNullIfExists<Traits>(output);
75 75
76 {{mojom_type}}DataView data_view(input, context); 76 {{mojom_type}}DataView data_view(input, context);
77 return Traits::Read(data_view, output); 77 return Traits::Read(data_view, output);
78 } 78 }
79 }; 79 };
80 80
81 } // namespace internal 81 } // namespace internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698