Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(104)

Side by Side Diff: mojo/public/c/bindings/array.h

Issue 2200843002: C bindings: Implement _DeepCopy() & some unittests. (Closed) Base URL: git@github.com:domokit/mojo.git@cgen_validate
Patch Set: Address comments: no longer move, but copy instead. Return NULL if insufficient space. Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | mojo/public/c/bindings/lib/array.c » ('j') | mojo/public/c/bindings/lib/union.c » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_ARRAY_H_ 5 #ifndef MOJO_PUBLIC_C_BINDINGS_ARRAY_H_
6 #define MOJO_PUBLIC_C_BINDINGS_ARRAY_H_ 6 #define MOJO_PUBLIC_C_BINDINGS_ARRAY_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "mojo/public/c/bindings/buffer.h" 10 #include "mojo/public/c/bindings/buffer.h"
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 // |inout_context|: An initialized context that contains the expected location 107 // |inout_context|: An initialized context that contains the expected location
108 // of the next pointer and next offset. This is used to 108 // of the next pointer and next offset. This is used to
109 // validate that no two pointers or handles are shared. 109 // validate that no two pointers or handles are shared.
110 MojomValidationResult MojomArray_Validate( 110 MojomValidationResult MojomArray_Validate(
111 const struct MojomTypeDescriptorArray* in_type_desc, 111 const struct MojomTypeDescriptorArray* in_type_desc,
112 const struct MojomArrayHeader* in_array, 112 const struct MojomArrayHeader* in_array,
113 uint32_t in_array_size, 113 uint32_t in_array_size,
114 uint32_t in_num_handles, 114 uint32_t in_num_handles,
115 struct MojomValidationContext* inout_context); 115 struct MojomValidationContext* inout_context);
116 116
117 // Creates a new copy of |in_array| using |buffer| to allocate space.
118 // Recursively creates new copies of any references from |in_array|, and updates
119 // the references to point to the new copies. This operation is useful if you
120 // want to linearize |in_array| using the buffer backed by |buffer|. The new
121 // copy of the array is returned, or NULL if there is insufficient space in the
122 // buffer, in which case the buffer may be partially used.
123 // |buffer|: A mojom buffer used to allocate space for the new array.
124 // |in_type_desc|: Describes the pointer and handle fields of the mojom array.
125 // |in_array|: The unencoded mojom array to be copied.
126 struct MojomArrayHeader* MojomArray_DeepCopy(
127 struct MojomBuffer* buffer,
128 const struct MojomTypeDescriptorArray* in_type_desc,
129 const struct MojomArrayHeader* in_array);
130
117 MOJO_END_EXTERN_C 131 MOJO_END_EXTERN_C
118 132
119 #endif // MOJO_PUBLIC_C_BINDINGS_ARRAY_H_ 133 #endif // MOJO_PUBLIC_C_BINDINGS_ARRAY_H_
OLDNEW
« no previous file with comments | « no previous file | mojo/public/c/bindings/lib/array.c » ('j') | mojo/public/c/bindings/lib/union.c » ('J')

Powered by Google App Engine
This is Rietveld 408576698