| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef MOJO_PUBLIC_C_BINDINGS_UNION_H_ | 5 #ifndef MOJO_PUBLIC_C_BINDINGS_UNION_H_ |
| 6 #define MOJO_PUBLIC_C_BINDINGS_UNION_H_ | 6 #define MOJO_PUBLIC_C_BINDINGS_UNION_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 // of the next pointer and next offset. This is used to | 90 // of the next pointer and next offset. This is used to |
| 91 // validate that no two pointers or handles are shared. | 91 // validate that no two pointers or handles are shared. |
| 92 MojomValidationResult MojomUnion_Validate( | 92 MojomValidationResult MojomUnion_Validate( |
| 93 const struct MojomTypeDescriptorUnion* in_type_desc, | 93 const struct MojomTypeDescriptorUnion* in_type_desc, |
| 94 bool in_nullable, | 94 bool in_nullable, |
| 95 const struct MojomUnionLayout* in_union, | 95 const struct MojomUnionLayout* in_union, |
| 96 uint32_t in_union_size, | 96 uint32_t in_union_size, |
| 97 uint32_t in_num_handles, | 97 uint32_t in_num_handles, |
| 98 struct MojomValidationContext* inout_context); | 98 struct MojomValidationContext* inout_context); |
| 99 | 99 |
| 100 // Copies over |in_union_data| into |out_union_data|, recursively copying any |
| 101 // references from |in_union_data| using |buffer| to allocate space, and |
| 102 // updating the references to point to the new copies. Note that a space is |
| 103 // never allocated for the new union data in this function -- |out_union_data| |
| 104 // should already be allocated for this function ahead of time. Returns false if |
| 105 // the copy couldn't be made (insufficient space, or unrecognized tag), in which |
| 106 // case the buffer may be partially used. |
| 107 // |buffer|: A mojom buffer used to allocate space for any references from the |
| 108 // union. |
| 109 // |in_type_desc|: Describes the pointer and handle fields of the mojom union. |
| 110 // |in_union_data|: The unencoded mojom union to be copied. |
| 111 // |out_union_data|: Where |in_union_data| should be copied to. |
| 112 bool MojomUnion_DeepCopy(struct MojomBuffer* buffer, |
| 113 const struct MojomTypeDescriptorUnion* in_type_desc, |
| 114 const struct MojomUnionLayout* in_union_data, |
| 115 struct MojomUnionLayout* out_union_data); |
| 116 |
| 100 MOJO_END_EXTERN_C | 117 MOJO_END_EXTERN_C |
| 101 | 118 |
| 102 #endif // MOJO_PUBLIC_C_BINDINGS_UNION_H_ | 119 #endif // MOJO_PUBLIC_C_BINDINGS_UNION_H_ |
| OLD | NEW |