Upstream version 7.35.144.0
[platform/framework/web/crosswalk.git] / src / mojo / public / tools / bindings / generators / cpp_templates / struct_destructor.tmpl
1 {%- set class_name = struct.name ~ "_Data" %}
2 {%- if struct|is_struct_with_handles %}
3 static void {{class_name}}_Destructor(void* address) {
4   {{class_name}}* data = static_cast<{{class_name}}*>(address);
5 {%-   for pf in struct.packed.packed_fields %}
6 {%-     if pf.field.kind|is_handle_kind %}
7   (void) mojo::MakePassable(data->{{pf.field.name}}()).Pass();
8 {%-     endif %}
9 {%-   endfor %}
10 }
11 {%- endif %}