| Index: mojo/public/tools/bindings/generators/cpp_templates/union_declaration.tmpl
|
| diff --git a/mojo/public/tools/bindings/generators/cpp_templates/union_declaration.tmpl b/mojo/public/tools/bindings/generators/cpp_templates/union_declaration.tmpl
|
| index d65854073187bfc6aed181e11d6a8d55407820b5..005ba76b611fa0f1bc7cae6af20fa5cbc1413b82 100644
|
| --- a/mojo/public/tools/bindings/generators/cpp_templates/union_declaration.tmpl
|
| +++ b/mojo/public/tools/bindings/generators/cpp_templates/union_declaration.tmpl
|
| @@ -7,23 +7,26 @@ class {{class_name}} {
|
| // Used to identify Mojom Union Data Classes.
|
| typedef void MojomUnionDataType;
|
|
|
| + {{class_name}}() {}
|
| + // Do nothing in the destructor since it won't be called when it is a
|
| + // non-inlined union.
|
| + ~{{class_name}}() {}
|
| +
|
| static {{class_name}}* New(mojo::internal::Buffer* buf) {
|
| return new (buf->Allocate(sizeof({{class_name}}))) {{class_name}}();
|
| }
|
|
|
| - {{class_name}}();
|
| - // Do nothing in the destructor since it won't be called.
|
| - ~{{class_name}}() {}
|
| -
|
| static bool Validate(const void* data,
|
| mojo::internal::ValidationContext* validation_context,
|
| bool inlined);
|
|
|
| - bool is_null() const {
|
| - return size == 0;
|
| - }
|
| + bool is_null() const { return size == 0; }
|
|
|
| - void set_null();
|
| + void set_null() {
|
| + size = 0U;
|
| + tag = static_cast<{{enum_name}}>(0);
|
| + data.unknown = 0U;
|
| + }
|
|
|
| enum class {{enum_name}} : uint32_t {
|
| {% for field in union.fields %}
|
|
|