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

Side by Side Diff: mojo/public/cpp/bindings/lib/array_internal.h

Issue 2259283003: Mojo C++ bindings: share DataView class between chromium and blink variants. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@92_change_traits_param
Patch Set: . 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_LIB_ARRAY_INTERNAL_H_ 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_ARRAY_INTERNAL_H_
6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_ARRAY_INTERNAL_H_ 6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_ARRAY_INTERNAL_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 102
103 // What follows is code to support the serialization/validation of 103 // What follows is code to support the serialization/validation of
104 // Array_Data<T>. There are four interesting cases: arrays of primitives, 104 // Array_Data<T>. There are four interesting cases: arrays of primitives,
105 // arrays of handles/interfaces, arrays of objects and arrays of unions. 105 // arrays of handles/interfaces, arrays of objects and arrays of unions.
106 // Arrays of objects are represented as arrays of pointers to objects. Arrays 106 // Arrays of objects are represented as arrays of pointers to objects. Arrays
107 // of unions are inlined so they are not pointers, but comparing with primitives 107 // of unions are inlined so they are not pointers, but comparing with primitives
108 // they require more work for serialization/validation. 108 // they require more work for serialization/validation.
109 // 109 //
110 // TODO(yzshen): Validation code should be organzied in a way similar to 110 // TODO(yzshen): Validation code should be organzied in a way similar to
111 // Serializer<>, or merged into it. It should be templatized with the mojo 111 // Serializer<>, or merged into it. It should be templatized with the mojo
112 // wrapper type instead of the data type, that way we can use MojomTypeTraits 112 // data view type instead of the data type, that way we can use MojomTypeTraits
113 // to determine the categories. 113 // to determine the categories.
114 114
115 template <typename T, bool is_union, bool is_handle_or_interface> 115 template <typename T, bool is_union, bool is_handle_or_interface>
116 struct ArraySerializationHelper; 116 struct ArraySerializationHelper;
117 117
118 template <typename T> 118 template <typename T>
119 struct ArraySerializationHelper<T, false, false> { 119 struct ArraySerializationHelper<T, false, false> {
120 using ElementType = typename ArrayDataTraits<T>::StorageType; 120 using ElementType = typename ArrayDataTraits<T>::StorageType;
121 121
122 static bool ValidateElements(const ArrayHeader* header, 122 static bool ValidateElements(const ArrayHeader* header,
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 }; 358 };
359 static_assert(sizeof(Array_Data<char>) == 8, "Bad sizeof(Array_Data)"); 359 static_assert(sizeof(Array_Data<char>) == 8, "Bad sizeof(Array_Data)");
360 360
361 // UTF-8 encoded 361 // UTF-8 encoded
362 using String_Data = Array_Data<char>; 362 using String_Data = Array_Data<char>;
363 363
364 } // namespace internal 364 } // namespace internal
365 } // namespace mojo 365 } // namespace mojo
366 366
367 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_ARRAY_INTERNAL_H_ 367 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_ARRAY_INTERNAL_H_
OLDNEW
« no previous file with comments | « mojo/public/cpp/bindings/interface_data_view.h ('k') | mojo/public/cpp/bindings/lib/array_serialization.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698