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

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

Issue 1526533002: [mojo] Add pickling support for native-only structs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bindings-4-bool-deserialize
Patch Set: merge Created 5 years 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 {%- from "enum_macros.tmpl" import is_valid_enum_def %} 1 {%- from "enum_macros.tmpl" import is_valid_enum_def %}
2 2
3 {#--- Enums #} 3 {#--- Enums #}
4 {%- for enum in struct.enums -%} 4 {%- for enum in struct.enums -%}
5 {{is_valid_enum_def(enum, class_name=struct.name)}} 5 {{is_valid_enum_def(enum, class_name=struct.name)}}
6 {%- endfor %} 6 {%- endfor %}
7 7
8 // static 8 // static
9 {{struct.name}}Ptr {{struct.name}}::New() { 9 {{struct.name}}Ptr {{struct.name}}::New() {
10 {{struct.name}}Ptr rv; 10 {{struct.name}}Ptr rv;
(...skipping 19 matching lines...) Expand all
30 {%- else %} 30 {%- else %}
31 rv->{{field.name}} = {{field.name}}; 31 rv->{{field.name}} = {{field.name}};
32 {%- endif %} 32 {%- endif %}
33 {%- endfor %} 33 {%- endfor %}
34 return rv.Pass(); 34 return rv.Pass();
35 } 35 }
36 {% endif %} 36 {% endif %}
37 37
38 bool {{struct.name}}::Equals(const {{struct.name}}& other) const { 38 bool {{struct.name}}::Equals(const {{struct.name}}& other) const {
39 {%- for field in struct.fields %} 39 {%- for field in struct.fields %}
40 {%- if field.kind|is_typemapped_kind %}
41 {# TODO(rockot): Consider adding support for native equality testing. #}
42 NOTREACHED() << "Equality testing not supported with typemapped fields.";
43 {%- else %}
40 if (!mojo::internal::ValueTraits<{{field.kind|cpp_wrapper_type}}>::Equals(this ->{{field.name}}, other.{{field.name}})) 44 if (!mojo::internal::ValueTraits<{{field.kind|cpp_wrapper_type}}>::Equals(this ->{{field.name}}, other.{{field.name}}))
41 return false; 45 return false;
46 {%- endif %}
42 {%- endfor %} 47 {%- endfor %}
43 return true; 48 return true;
44 } 49 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698