| 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/template_util.h" | 8 #include "mojo/public/cpp/bindings/lib/template_util.h" |
| 9 #include "mojo/public/cpp/bindings/struct_ptr.h" | 9 #include "mojo/public/cpp/bindings/struct_ptr.h" |
| 10 #include "mojo/public/cpp/system/core.h" | 10 #include "mojo/public/cpp/system/core.h" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 T temp = *ptr; | 69 T temp = *ptr; |
| 70 *ptr = T(); | 70 *ptr = T(); |
| 71 return temp; | 71 return temp; |
| 72 } | 72 } |
| 73 | 73 |
| 74 template <typename H> | 74 template <typename H> |
| 75 struct IsHandle { | 75 struct IsHandle { |
| 76 enum { value = IsBaseOf<Handle, H>::value }; | 76 enum { value = IsBaseOf<Handle, H>::value }; |
| 77 }; | 77 }; |
| 78 | 78 |
| 79 template <typename T> |
| 80 struct IsUnionDataType { |
| 81 template <typename U> |
| 82 static YesType Test(const typename U::MojomUnionDataType*); |
| 83 |
| 84 template <typename U> |
| 85 static NoType Test(...); |
| 86 |
| 87 static const bool value = |
| 88 sizeof(Test<T>(0)) == sizeof(YesType) && !IsConst<T>::value; |
| 89 }; |
| 90 |
| 79 template <typename T, bool move_only = IsMoveOnlyType<T>::value> | 91 template <typename T, bool move_only = IsMoveOnlyType<T>::value> |
| 80 struct WrapperTraits; | 92 struct WrapperTraits; |
| 81 | 93 |
| 82 template <typename T> | 94 template <typename T> |
| 83 struct WrapperTraits<T, false> { | 95 struct WrapperTraits<T, false> { |
| 84 typedef T DataType; | 96 typedef T DataType; |
| 85 }; | 97 }; |
| 86 template <typename H> | 98 template <typename H> |
| 87 struct WrapperTraits<ScopedHandleBase<H>, true> { | 99 struct WrapperTraits<ScopedHandleBase<H>, true> { |
| 88 typedef H DataType; | 100 typedef H DataType; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 static bool Equals(const ScopedHandleBase<T>& a, | 132 static bool Equals(const ScopedHandleBase<T>& a, |
| 121 const ScopedHandleBase<T>& b) { | 133 const ScopedHandleBase<T>& b) { |
| 122 return a.get().value() == b.get().value(); | 134 return a.get().value() == b.get().value(); |
| 123 } | 135 } |
| 124 }; | 136 }; |
| 125 | 137 |
| 126 } // namespace internal | 138 } // namespace internal |
| 127 } // namespace mojo | 139 } // namespace mojo |
| 128 | 140 |
| 129 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDINGS_INTERNAL_H_ | 141 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDINGS_INTERNAL_H_ |
| OLD | NEW |