| 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/system/core.h" | 9 #include "mojo/public/cpp/system/core.h" |
| 10 | 10 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 } | 57 } |
| 58 | 58 |
| 59 template <typename T> | 59 template <typename T> |
| 60 T FetchAndReset(T* ptr) { | 60 T FetchAndReset(T* ptr) { |
| 61 T temp = *ptr; | 61 T temp = *ptr; |
| 62 *ptr = T(); | 62 *ptr = T(); |
| 63 return temp; | 63 return temp; |
| 64 } | 64 } |
| 65 | 65 |
| 66 template <typename H> struct IsHandle { | 66 template <typename H> struct IsHandle { |
| 67 static const bool value = IsBaseOf<Handle, H>::value; | 67 enum { value = IsBaseOf<Handle, H>::value }; |
| 68 }; | 68 }; |
| 69 | 69 |
| 70 template <typename T, bool move_only = IsMoveOnlyType<T>::value> | 70 template <typename T, bool move_only = IsMoveOnlyType<T>::value> |
| 71 struct WrapperTraits; | 71 struct WrapperTraits; |
| 72 | 72 |
| 73 template <typename T> struct WrapperTraits<T, false> { | 73 template <typename T> struct WrapperTraits<T, false> { |
| 74 typedef T DataType; | 74 typedef T DataType; |
| 75 }; | 75 }; |
| 76 template <typename H> struct WrapperTraits<ScopedHandleBase<H>, true> { | 76 template <typename H> struct WrapperTraits<ScopedHandleBase<H>, true> { |
| 77 typedef H DataType; | 77 typedef H DataType; |
| 78 }; | 78 }; |
| 79 template <typename S> struct WrapperTraits<S, true> { | 79 template <typename S> struct WrapperTraits<S, true> { |
| 80 typedef typename S::Data_* DataType; | 80 typedef typename S::Data_* DataType; |
| 81 }; | 81 }; |
| 82 | 82 |
| 83 } // namespace internal | 83 } // namespace internal |
| 84 } // namespace mojo | 84 } // namespace mojo |
| 85 | 85 |
| 86 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDINGS_INTERNAL_H_ | 86 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDINGS_INTERNAL_H_ |
| OLD | NEW |