| OLD | NEW |
| 1 {%- set mojom_type = union|get_qualified_name_for_kind %} | 1 {%- set mojom_type = union|get_qualified_name_for_kind %} |
| 2 {%- set data_type = union|get_qualified_name_for_kind(internal=True) %} | 2 {%- set data_type = union|get_qualified_name_for_kind(internal=True) %} |
| 3 | 3 |
| 4 template <> | 4 template <> |
| 5 struct {{export_attribute}} UnionTraits<{{mojom_type}}, {{mojom_type}}Ptr> { | 5 struct {{export_attribute}} UnionTraits<{{mojom_type}}, {{mojom_type}}Ptr> { |
| 6 static bool IsNull(const {{mojom_type}}Ptr& input) { return !input; } | 6 static bool IsNull(const {{mojom_type}}Ptr& input) { return !input; } |
| 7 static void SetToNull({{mojom_type}}Ptr* output) { output->reset(); } | 7 static void SetToNull({{mojom_type}}Ptr* output) { output->reset(); } |
| 8 | 8 |
| 9 static {{mojom_type}}::Tag GetTag(const {{mojom_type}}Ptr& input) { | 9 static {{mojom_type}}::Tag GetTag(const {{mojom_type}}Ptr& input) { |
| 10 return input->which(); | 10 return input->which(); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 in_{{name}}, context); | 65 in_{{name}}, context); |
| 66 {%- endif %} | 66 {%- endif %} |
| 67 {%- endif %} | 67 {%- endif %} |
| 68 break; | 68 break; |
| 69 } | 69 } |
| 70 {%- endfor %} | 70 {%- endfor %} |
| 71 } | 71 } |
| 72 return size; | 72 return size; |
| 73 } | 73 } |
| 74 | 74 |
| 75 static void Serialize({{mojom_type}}Ptr& input, | 75 static void Serialize(MaybeConstUserType& input, |
| 76 Buffer* buffer, | 76 Buffer* buffer, |
| 77 {{data_type}}** output, | 77 {{data_type}}** output, |
| 78 bool inlined, | 78 bool inlined, |
| 79 SerializationContext* context) { | 79 SerializationContext* context) { |
| 80 if (CallIsNullIfExists<Traits>(input)) { | 80 if (CallIsNullIfExists<Traits>(input)) { |
| 81 if (inlined) | 81 if (inlined) |
| 82 (*output)->set_null(); | 82 (*output)->set_null(); |
| 83 else | 83 else |
| 84 *output = nullptr; | 84 *output = nullptr; |
| 85 return; | 85 return; |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 {%- endif %} | 149 {%- endif %} |
| 150 break; | 150 break; |
| 151 } | 151 } |
| 152 {%- endfor %} | 152 {%- endfor %} |
| 153 } | 153 } |
| 154 | 154 |
| 155 CustomContextHelper<Traits>::TearDown(input, custom_context); | 155 CustomContextHelper<Traits>::TearDown(input, custom_context); |
| 156 } | 156 } |
| 157 | 157 |
| 158 static bool Deserialize({{data_type}}* input, | 158 static bool Deserialize({{data_type}}* input, |
| 159 {{mojom_type}}Ptr* output, | 159 UserType* output, |
| 160 SerializationContext* context) { | 160 SerializationContext* context) { |
| 161 if (!input || input->is_null()) | 161 if (!input || input->is_null()) |
| 162 return CallSetToNullIfExists<Traits>(output); | 162 return CallSetToNullIfExists<Traits>(output); |
| 163 | 163 |
| 164 {{mojom_type}}DataView data_view(input, context); | 164 {{mojom_type}}DataView data_view(input, context); |
| 165 return Traits::Read(data_view, output); | 165 return Traits::Read(data_view, output); |
| 166 } | 166 } |
| 167 }; | 167 }; |
| 168 | 168 |
| 169 } // namespace internal | 169 } // namespace internal |
| OLD | NEW |