Chromium Code Reviews| 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 19 matching lines...) Expand all Loading... | |
| 30 }; | 30 }; |
| 31 static_assert(sizeof(ArrayHeader) == 8, "Bad_sizeof(ArrayHeader)"); | 31 static_assert(sizeof(ArrayHeader) == 8, "Bad_sizeof(ArrayHeader)"); |
| 32 | 32 |
| 33 template <typename T> | 33 template <typename T> |
| 34 union StructPointer { | 34 union StructPointer { |
| 35 uint64_t offset; | 35 uint64_t offset; |
| 36 T* ptr; | 36 T* ptr; |
| 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 union NativePointer { | |
|
yzshen1
2015/12/15 21:20:26
Please define it as an alias of ArrayPointer<uint8
Ken Rockot(use gerrit already)
2015/12/15 23:31:07
Actually I've decided to just get rid of this alto
| |
| 41 uint64_t offset; | |
| 42 Array_Data<uint8_t>* ptr; | |
| 43 }; | |
| 44 static_assert(sizeof(NativePointer) == 8, "Bad_sizeof(NativePointer)"); | |
| 45 | |
| 40 template <typename T> | 46 template <typename T> |
| 41 union ArrayPointer { | 47 union ArrayPointer { |
| 42 uint64_t offset; | 48 uint64_t offset; |
| 43 Array_Data<T>* ptr; | 49 Array_Data<T>* ptr; |
| 44 }; | 50 }; |
| 45 static_assert(sizeof(ArrayPointer<char>) == 8, "Bad_sizeof(ArrayPointer)"); | 51 static_assert(sizeof(ArrayPointer<char>) == 8, "Bad_sizeof(ArrayPointer)"); |
| 46 | 52 |
| 47 using StringPointer = ArrayPointer<char>; | 53 using StringPointer = ArrayPointer<char>; |
| 48 static_assert(sizeof(StringPointer) == 8, "Bad_sizeof(StringPointer)"); | 54 static_assert(sizeof(StringPointer) == 8, "Bad_sizeof(StringPointer)"); |
| 49 | 55 |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 123 }; | 129 }; |
| 124 template <typename S> | 130 template <typename S> |
| 125 struct WrapperTraits<S, true> { | 131 struct WrapperTraits<S, true> { |
| 126 typedef typename S::Data_* DataType; | 132 typedef typename S::Data_* DataType; |
| 127 }; | 133 }; |
| 128 | 134 |
| 129 } // namespace internal | 135 } // namespace internal |
| 130 } // namespace mojo | 136 } // namespace mojo |
| 131 | 137 |
| 132 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDINGS_INTERNAL_H_ | 138 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDINGS_INTERNAL_H_ |
| OLD | NEW |