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

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

Issue 2689513003: Add field-initializing constructors to generated mojo structs. (Closed)
Patch Set: rebase 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 // static 1 // static
2 {{union.name}}Ptr {{union.name}}::New() { 2 {{union.name}}Ptr {{union.name}}::New() {
3 {{union.name}}Ptr rv; 3 return {{union.name}}Ptr(base::in_place);
4 mojo::internal::StructHelper<{{union.name}}>::Initialize(&rv);
5 return rv;
6 } 4 }
7 5
8 {{union.name}}::{{union.name}}() { 6 {{union.name}}::{{union.name}}() {
9 // TODO(azani): Implement default values here when/if we support them. 7 // TODO(azani): Implement default values here when/if we support them.
10 // TODO(azani): Set to UNKNOWN when unknown is implemented. 8 // TODO(azani): Set to UNKNOWN when unknown is implemented.
11 SetActive(static_cast<Tag>(0)); 9 SetActive(static_cast<Tag>(0));
12 } 10 }
13 11
14 {{union.name}}::~{{union.name}}() { 12 {{union.name}}::~{{union.name}}() {
15 DestroyActive(); 13 DestroyActive();
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 return mojo::internal::Hash(seed, data_.{{field.name}}); 76 return mojo::internal::Hash(seed, data_.{{field.name}});
79 {%- endif %} 77 {%- endif %}
80 {%- endfor %} 78 {%- endfor %}
81 default: 79 default:
82 NOTREACHED(); 80 NOTREACHED();
83 return seed; 81 return seed;
84 } 82 }
85 } 83 }
86 84
87 {%- endif %} 85 {%- endif %}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698