X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fmojo%2Fpublic%2Fcpp%2Fbindings%2Flib%2Fbindings_internal.h;h=ec70d37716e05005da7d3f0fb9ada1b2d10cb052;hb=1afa4dd80ef85af7c90efaea6959db1d92330844;hp=f12be10ab62a16923d0d0d216c84deb08d1edbe2;hpb=90762837333c13ccf56f2ad88e4481fc71e8d281;p=platform%2Fframework%2Fweb%2Fcrosswalk.git diff --git a/src/mojo/public/cpp/bindings/lib/bindings_internal.h b/src/mojo/public/cpp/bindings/lib/bindings_internal.h index f12be10..ec70d37 100644 --- a/src/mojo/public/cpp/bindings/lib/bindings_internal.h +++ b/src/mojo/public/cpp/bindings/lib/bindings_internal.h @@ -6,13 +6,21 @@ #define MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDINGS_INTERNAL_H_ #include "mojo/public/cpp/bindings/lib/template_util.h" +#include "mojo/public/cpp/bindings/struct_ptr.h" #include "mojo/public/cpp/system/core.h" namespace mojo { class String; +template +class Array; + +template +class Map; + namespace internal { -template class Array_Data; +template +class Array_Data; #pragma pack(push, 1) @@ -20,33 +28,33 @@ struct StructHeader { uint32_t num_bytes; uint32_t num_fields; }; -MOJO_COMPILE_ASSERT(sizeof(StructHeader) == 8, bad_sizeof_StructHeader); +static_assert(sizeof(StructHeader) == 8, "Bad sizeof(StructHeader)"); struct ArrayHeader { uint32_t num_bytes; uint32_t num_elements; }; -MOJO_COMPILE_ASSERT(sizeof(ArrayHeader) == 8, bad_sizeof_ArrayHeader); +static_assert(sizeof(ArrayHeader) == 8, "Bad_sizeof(ArrayHeader)"); template union StructPointer { uint64_t offset; T* ptr; }; -MOJO_COMPILE_ASSERT(sizeof(StructPointer) == 8, bad_sizeof_StructPointer); +static_assert(sizeof(StructPointer) == 8, "Bad_sizeof(StructPointer)"); template union ArrayPointer { uint64_t offset; Array_Data* ptr; }; -MOJO_COMPILE_ASSERT(sizeof(ArrayPointer) == 8, bad_sizeof_ArrayPointer); +static_assert(sizeof(ArrayPointer) == 8, "Bad_sizeof(ArrayPointer)"); union StringPointer { uint64_t offset; Array_Data* ptr; }; -MOJO_COMPILE_ASSERT(sizeof(StringPointer) == 8, bad_sizeof_StringPointer); +static_assert(sizeof(StringPointer) == 8, "Bad_sizeof(StringPointer)"); #pragma pack(pop) @@ -63,23 +71,58 @@ T FetchAndReset(T* ptr) { return temp; } -template struct IsHandle { +template +struct IsHandle { enum { value = IsBaseOf::value }; }; template ::value> struct WrapperTraits; -template struct WrapperTraits { +template +struct WrapperTraits { typedef T DataType; }; -template struct WrapperTraits, true> { +template +struct WrapperTraits, true> { typedef H DataType; }; -template struct WrapperTraits { +template +struct WrapperTraits, true> { + typedef typename S::Data_* DataType; +}; +template +struct WrapperTraits, true> { + typedef typename S::Data_* DataType; +}; +template +struct WrapperTraits { typedef typename S::Data_* DataType; }; +template +struct ValueTraits { + static bool Equals(const T& a, const T& b) { return a == b; } +}; + +template +struct ValueTraits< + T, + typename EnableIf::value || + IsSpecializationOf::value || + IsSpecializationOf::value || + IsSpecializationOf::value>::type> { + static bool Equals(const T& a, const T& b) { return a.Equals(b); } +}; + +template +struct ValueTraits> { + static bool Equals(const ScopedHandleBase& a, + const ScopedHandleBase& b) { + return a.get().value() == b.get().value(); + } +}; + } // namespace internal } // namespace mojo