| 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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 }; | 179 }; |
| 180 | 180 |
| 181 template <typename T> | 181 template <typename T> |
| 182 struct ValueTraits<ScopedHandleBase<T>> { | 182 struct ValueTraits<ScopedHandleBase<T>> { |
| 183 static bool Equals(const ScopedHandleBase<T>& a, | 183 static bool Equals(const ScopedHandleBase<T>& a, |
| 184 const ScopedHandleBase<T>& b) { | 184 const ScopedHandleBase<T>& b) { |
| 185 return a.get().value() == b.get().value(); | 185 return a.get().value() == b.get().value(); |
| 186 } | 186 } |
| 187 }; | 187 }; |
| 188 | 188 |
| 189 template <typename T> |
| 190 struct UnwrapStructPtr { |
| 191 static T* value(T& x) { return &x; } |
| 192 }; |
| 193 |
| 194 template <typename T> |
| 195 struct UnwrapStructPtr<StructPtr<T>> { |
| 196 static T* value(StructPtr<T>& x) { return x.get(); } |
| 197 }; |
| 198 |
| 199 template <typename T> |
| 200 struct UnwrapStructPtr<InlinedStructPtr<T>> { |
| 201 static T* value(InlinedStructPtr<T>& x) { return x.get(); } |
| 202 }; |
| 203 |
| 204 template <typename T> |
| 205 struct UnwrapConstStructPtr { |
| 206 static const T* value(const T& x) { return &x; } |
| 207 }; |
| 208 |
| 209 template <typename T> |
| 210 struct UnwrapConstStructPtr<StructPtr<T>> { |
| 211 static const T* value(const StructPtr<T>& x) { return x.get(); } |
| 212 }; |
| 213 |
| 214 template <typename T> |
| 215 struct UnwrapConstStructPtr<InlinedStructPtr<T>> { |
| 216 static const T* value(const InlinedStructPtr<T>& x) { return x.get(); } |
| 217 }; |
| 218 |
| 189 } // namespace internal | 219 } // namespace internal |
| 190 } // namespace mojo | 220 } // namespace mojo |
| 191 | 221 |
| 192 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDINGS_INTERNAL_H_ | 222 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDINGS_INTERNAL_H_ |
| OLD | NEW |