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

Side by Side Diff: mojo/public/cpp/bindings/struct_traits.h

Issue 2277903004: Mojo C++ bindings: minor corrections for the StructTraits documentation. (Closed)
Patch Set: Created 4 years, 3 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_CPP_BINDINGS_STRUCT_TRAITS_H_ 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_STRUCT_TRAITS_H_
6 #define MOJO_PUBLIC_CPP_BINDINGS_STRUCT_TRAITS_H_ 6 #define MOJO_PUBLIC_CPP_BINDINGS_STRUCT_TRAITS_H_
7 7
8 namespace mojo { 8 namespace mojo {
9 9
10 // This must be specialized for any type |T| to be serialized/deserialized as 10 // This must be specialized for any type |T| to be serialized/deserialized as
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 // to getters. After serialization is done, it calls TearDownContext() so 115 // to getters. After serialization is done, it calls TearDownContext() so
116 // that you can do any necessary cleanup. 116 // that you can do any necessary cleanup.
117 // 117 //
118 // In the description above, methods having an |input| parameter define it as 118 // In the description above, methods having an |input| parameter define it as
119 // const reference of T. Actually, it can be a non-const reference of T too. 119 // const reference of T. Actually, it can be a non-const reference of T too.
120 // E.g., if T contains Mojo handles or interfaces whose ownership needs to be 120 // E.g., if T contains Mojo handles or interfaces whose ownership needs to be
121 // transferred. Correspondingly, it requies you to always give non-const T 121 // transferred. Correspondingly, it requies you to always give non-const T
122 // reference/value to the Mojo bindings for serialization: 122 // reference/value to the Mojo bindings for serialization:
123 // - if T is used in the "type_mappings" section of a typemap config file, 123 // - if T is used in the "type_mappings" section of a typemap config file,
124 // you need to declare it as pass-by-value: 124 // you need to declare it as pass-by-value:
125 // type_mappings = [ "MojomType=T(move_only)" ] 125 // type_mappings = [ "MojomType=T[move_only]" ]
126 // or 126 // or
127 // type_mappings = [ "MojomType=T(copyable_pass_by_value)" ] 127 // type_mappings = [ "MojomType=T[copyable_pass_by_value]" ]
128 // 128 //
129 // - if another type U's StructTraits/UnionTraits has a getter for T, it 129 // - if another type U's StructTraits/UnionTraits has a getter for T, it
130 // needs to return non-const reference/value. 130 // needs to return non-const reference/value.
131 // 131 //
132 // EXAMPLE: 132 // EXAMPLE:
133 // 133 //
134 // Mojom definition: 134 // Mojom definition:
135 // struct Bar {}; 135 // struct Bar {};
136 // struct Foo { 136 // struct Foo {
137 // int32 f_integer; 137 // int32 f_integer;
(...skipping 19 matching lines...) Expand all
157 // 157 //
158 // static bool Read(FooDataView data, CustomFoo* output); 158 // static bool Read(FooDataView data, CustomFoo* output);
159 // }; 159 // };
160 // 160 //
161 template <typename DataViewType, typename T> 161 template <typename DataViewType, typename T>
162 struct StructTraits; 162 struct StructTraits;
163 163
164 } // namespace mojo 164 } // namespace mojo
165 165
166 #endif // MOJO_PUBLIC_CPP_BINDINGS_STRUCT_TRAITS_H_ 166 #endif // MOJO_PUBLIC_CPP_BINDINGS_STRUCT_TRAITS_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698