// Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_CALLBACK_INTERNAL_H_ #define MOJO_PUBLIC_CPP_BINDINGS_LIB_CALLBACK_INTERNAL_H_ #include "mojo/public/cpp/bindings/lib/bindings_internal.h" namespace mojo { namespace internal { template ::kIsObject> struct Callback_ParamTraits {}; template struct Callback_ParamTraits { typedef const T& ForwardType; static const bool kIsScopedHandle = false; }; template struct Callback_ParamTraits { typedef T ForwardType; static const bool kIsScopedHandle = false; }; template struct Callback_ParamTraits, true> { typedef ScopedHandleBase ForwardType; static const bool kIsScopedHandle = true; }; template struct EnableIf {}; template struct EnableIf { typedef T type; }; template typename EnableIf::kIsScopedHandle, T>::type& Callback_Forward(T& t) { return t; } template typename EnableIf::kIsScopedHandle, T>::type Callback_Forward(T& t) { return t.Pass(); } } // namespace internal } // namespace mojo #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_CALLBACK_INTERNAL_H_