| 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 // |inout_handles|: Mojo handles are moved out of this array and into | 70 // |inout_handles|: Mojo handles are moved out of this array and into |
| 71 // |inout_union|, using the encoded index into this array. | 71 // |inout_union|, using the encoded index into this array. |
| 72 // |in_num_handles|: Size in # of number elements available in |inout_handles|. | 72 // |in_num_handles|: Size in # of number elements available in |inout_handles|. |
| 73 void MojomUnion_DecodePointersAndHandles( | 73 void MojomUnion_DecodePointersAndHandles( |
| 74 const struct MojomTypeDescriptorUnion* in_type_desc, | 74 const struct MojomTypeDescriptorUnion* in_type_desc, |
| 75 struct MojomUnionLayout* inout_union, | 75 struct MojomUnionLayout* inout_union, |
| 76 uint32_t in_union_size, | 76 uint32_t in_union_size, |
| 77 MojoHandle* inout_handles, | 77 MojoHandle* inout_handles, |
| 78 uint32_t in_num_handles); | 78 uint32_t in_num_handles); |
| 79 | 79 |
| 80 // Validates the mojom union described by the |in_union| buffer. Any |
| 81 // references from the union are also recursively validated, and are expected to |
| 82 // be in the same buffer backing |in_union|. |
| 83 // |in_type_desc|: Describes the pointer and handle fields of the mojom union. |
| 84 // |in_union|: Buffer containing the union, and any other references |
| 85 // outside of the union. |
| 86 // |in_union_size|: Size of the buffer backed by |in_union| in bytes. |
| 87 // |in_num_handles|: Number of valid handles expected to be referenced from |
| 88 // |in_union|. |
| 89 // |inout_context|: An initialized context that contains the expected location |
| 90 // of the next pointer and next offset. This is used to |
| 91 // validate that no two pointers or handles are shared. |
| 92 MojomValidationResult MojomUnion_Validate( |
| 93 const struct MojomTypeDescriptorUnion* in_type_desc, |
| 94 bool in_nullable, |
| 95 const struct MojomUnionLayout* in_union, |
| 96 uint32_t in_union_size, |
| 97 uint32_t in_num_handles, |
| 98 struct MojomValidationContext* inout_context); |
| 99 |
| 80 MOJO_END_EXTERN_C | 100 MOJO_END_EXTERN_C |
| 81 | 101 |
| 82 #endif // MOJO_PUBLIC_C_BINDINGS_UNION_H_ | 102 #endif // MOJO_PUBLIC_C_BINDINGS_UNION_H_ |
| OLD | NEW |