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 <type_traits> | 8 #include <type_traits> |
9 | 9 |
10 #include "mojo/public/cpp/bindings/lib/template_util.h" | 10 #include "mojo/public/cpp/bindings/lib/template_util.h" |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
91 T temp = *ptr; | 91 T temp = *ptr; |
92 *ptr = T(); | 92 *ptr = T(); |
93 return temp; | 93 return temp; |
94 } | 94 } |
95 | 95 |
96 template <typename H> | 96 template <typename H> |
97 struct IsHandle { | 97 struct IsHandle { |
98 enum { value = std::is_base_of<Handle, H>::value }; | 98 enum { value = std::is_base_of<Handle, H>::value }; |
99 }; | 99 }; |
100 | 100 |
101 // TODO(vardhan): Should RemoveStructPtr<> be internal-only? Should be /the/ way | |
viettrungluu
2016/03/30 17:49:01
Hmmm. Or is specializing std::pointer_traits the r
vardhan
2016/03/30 22:49:07
yeah, good point; std::pointer_traits will defini
| |
102 // to get T from StructPtr<T>? | |
101 template <typename T> | 103 template <typename T> |
102 struct RemoveStructPtr { | 104 struct RemoveStructPtr { |
103 typedef T type; | 105 typedef T type; |
104 }; | 106 }; |
105 | 107 |
106 template <typename T> | 108 template <typename T> |
107 struct RemoveStructPtr<StructPtr<T>> { | 109 struct RemoveStructPtr<StructPtr<T>> { |
108 typedef T type; | 110 typedef T type; |
109 }; | 111 }; |
110 | 112 |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
270 static bool Equals(const InterfaceRequest<I>& a, | 272 static bool Equals(const InterfaceRequest<I>& a, |
271 const InterfaceRequest<I>& b) { | 273 const InterfaceRequest<I>& b) { |
272 return (&a == &b) || (!a.is_pending() && !b.is_pending()); | 274 return (&a == &b) || (!a.is_pending() && !b.is_pending()); |
273 } | 275 } |
274 }; | 276 }; |
275 | 277 |
276 } // namespace internal | 278 } // namespace internal |
277 } // namespace mojo | 279 } // namespace mojo |
278 | 280 |
279 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDINGS_INTERNAL_H_ | 281 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDINGS_INTERNAL_H_ |
OLD | NEW |