OLD | NEW |
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_BINDINGS_INTERNAL_H_ | 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDINGS_INTERNAL_H_ |
6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDINGS_INTERNAL_H_ | 6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDINGS_INTERNAL_H_ |
7 | 7 |
8 #include "mojo/public/cpp/bindings/lib/interface_id.h" | 8 #include "mojo/public/cpp/bindings/lib/interface_id.h" |
9 #include "mojo/public/cpp/bindings/lib/template_util.h" | 9 #include "mojo/public/cpp/bindings/lib/template_util.h" |
10 #include "mojo/public/cpp/bindings/struct_ptr.h" | 10 #include "mojo/public/cpp/bindings/struct_ptr.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 }; | 37 }; |
38 static_assert(sizeof(StructPointer<char>) == 8, "Bad_sizeof(StructPointer)"); | 38 static_assert(sizeof(StructPointer<char>) == 8, "Bad_sizeof(StructPointer)"); |
39 | 39 |
40 template <typename T> | 40 template <typename T> |
41 union ArrayPointer { | 41 union ArrayPointer { |
42 uint64_t offset; | 42 uint64_t offset; |
43 Array_Data<T>* ptr; | 43 Array_Data<T>* ptr; |
44 }; | 44 }; |
45 static_assert(sizeof(ArrayPointer<char>) == 8, "Bad_sizeof(ArrayPointer)"); | 45 static_assert(sizeof(ArrayPointer<char>) == 8, "Bad_sizeof(ArrayPointer)"); |
46 | 46 |
47 union StringPointer { | 47 using StringPointer = ArrayPointer<char>; |
48 uint64_t offset; | |
49 Array_Data<char>* ptr; | |
50 }; | |
51 static_assert(sizeof(StringPointer) == 8, "Bad_sizeof(StringPointer)"); | 48 static_assert(sizeof(StringPointer) == 8, "Bad_sizeof(StringPointer)"); |
52 | 49 |
53 | 50 |
54 template <typename T> | 51 template <typename T> |
55 union UnionPointer { | 52 union UnionPointer { |
56 uint64_t offset; | 53 uint64_t offset; |
57 T* ptr; | 54 T* ptr; |
58 }; | 55 }; |
59 static_assert(sizeof(UnionPointer<char>) == 8, "Bad_sizeof(UnionPointer)"); | 56 static_assert(sizeof(UnionPointer<char>) == 8, "Bad_sizeof(UnionPointer)"); |
60 | 57 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 }; | 123 }; |
127 template <typename S> | 124 template <typename S> |
128 struct WrapperTraits<S, true> { | 125 struct WrapperTraits<S, true> { |
129 typedef typename S::Data_* DataType; | 126 typedef typename S::Data_* DataType; |
130 }; | 127 }; |
131 | 128 |
132 } // namespace internal | 129 } // namespace internal |
133 } // namespace mojo | 130 } // namespace mojo |
134 | 131 |
135 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDINGS_INTERNAL_H_ | 132 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDINGS_INTERNAL_H_ |
OLD | NEW |