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

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

Issue 2754003005: Mojo C++ Bindings: fix mojom::Foo::Deserialize() for component build. (Closed)
Patch Set: . Created 3 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 class {{export_attribute}} {{struct.name}} { 1 class {{export_attribute}} {{struct.name}} {
2 public: 2 public:
3 using DataView = {{struct.name}}DataView; 3 using DataView = {{struct.name}}DataView;
4 using Data_ = internal::{{struct.name}}_Data; 4 using Data_ = internal::{{struct.name}}_Data;
5 5
6 {#--- Enums #} 6 {#--- Enums #}
7 {%- for enum in struct.enums -%} 7 {%- for enum in struct.enums -%}
8 using {{enum.name}} = {{enum|get_name_for_kind(flatten_nested_kind=True)}}; 8 using {{enum.name}} = {{enum|get_name_for_kind(flatten_nested_kind=True)}};
9 {%- endfor %} 9 {%- endfor %}
10 10
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 static {{serialization_result_type}} Serialize(UserType* input) { 66 static {{serialization_result_type}} Serialize(UserType* input) {
67 return mojo::internal::StructSerializeImpl< 67 return mojo::internal::StructSerializeImpl<
68 {{struct.name}}::DataView, {{serialization_result_type}}>(input); 68 {{struct.name}}::DataView, {{serialization_result_type}}>(input);
69 } 69 }
70 70
71 template <typename UserType> 71 template <typename UserType>
72 static bool Deserialize(const {{serialization_result_type}}& input, 72 static bool Deserialize(const {{serialization_result_type}}& input,
73 UserType* output) { 73 UserType* output) {
74 return mojo::internal::StructDeserializeImpl< 74 return mojo::internal::StructDeserializeImpl<
75 {{struct.name}}::DataView, {{serialization_result_type}}>( 75 {{struct.name}}::DataView, {{serialization_result_type}}>(
76 input, output); 76 input, output, Validate);
77 } 77 }
78 78
79 {#--- Struct members #} 79 {#--- Struct members #}
80 {% for field in struct.fields %} 80 {% for field in struct.fields %}
81 {%- set type = field.kind|cpp_wrapper_type %} 81 {%- set type = field.kind|cpp_wrapper_type %}
82 {%- set name = field.name %} 82 {%- set name = field.name %}
83 {{type}} {{name}}; 83 {{type}} {{name}};
84 {%- endfor %} 84 {%- endfor %}
85 85
86 private:
87 static bool Validate(const void* data,
88 mojo::internal::ValidationContext* validation_context);
89
86 {%- if struct|contains_move_only_members %} 90 {%- if struct|contains_move_only_members %}
87 private:
88 DISALLOW_COPY_AND_ASSIGN({{struct.name}}); 91 DISALLOW_COPY_AND_ASSIGN({{struct.name}});
89 {%- endif %} 92 {%- endif %}
90 }; 93 };
91 94
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698