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
3 // found in the LICENSE file.
5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDINGS_INTERNAL_H_
6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDINGS_INTERNAL_H_
8 #include "mojo/public/cpp/bindings/lib/template_util.h"
9 #include "mojo/public/cpp/system/core.h"
15 template <typename T
> class Array_Data
;
23 MOJO_COMPILE_ASSERT(sizeof(StructHeader
) == 8, bad_sizeof_StructHeader
);
27 uint32_t num_elements
;
29 MOJO_COMPILE_ASSERT(sizeof(ArrayHeader
) == 8, bad_sizeof_ArrayHeader
);
36 MOJO_COMPILE_ASSERT(sizeof(StructPointer
<char>) == 8, bad_sizeof_StructPointer
);
43 MOJO_COMPILE_ASSERT(sizeof(ArrayPointer
<char>) == 8, bad_sizeof_ArrayPointer
);
47 Array_Data
<char>* ptr
;
49 MOJO_COMPILE_ASSERT(sizeof(StringPointer
) == 8, bad_sizeof_StringPointer
);
54 void ResetIfNonNull(T
* ptr
) {
60 T
FetchAndReset(T
* ptr
) {
66 template <typename H
> struct IsHandle
{
67 enum { value
= IsBaseOf
<Handle
, H
>::value
};
70 template <typename T
, bool move_only
= IsMoveOnlyType
<T
>::value
>
73 template <typename T
> struct WrapperTraits
<T
, false> {
76 template <typename H
> struct WrapperTraits
<ScopedHandleBase
<H
>, true> {
79 template <typename S
> struct WrapperTraits
<S
, true> {
80 typedef typename
S::Data_
* DataType
;
83 } // namespace internal
86 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDINGS_INTERNAL_H_