Loading libs/binder/include/binder/IInterface.h +19 −0 Original line number Original line Diff line number Diff line Loading @@ -72,12 +72,18 @@ protected: // ---------------------------------------------------------------------- // ---------------------------------------------------------------------- #define DECLARE_META_INTERFACE(INTERFACE) \ #define DECLARE_META_INTERFACE(INTERFACE) \ public: \ static const ::android::String16 descriptor; \ static const ::android::String16 descriptor; \ static ::android::sp<I##INTERFACE> asInterface( \ static ::android::sp<I##INTERFACE> asInterface( \ const ::android::sp<::android::IBinder>& obj); \ const ::android::sp<::android::IBinder>& obj); \ virtual const ::android::String16& getInterfaceDescriptor() const; \ virtual const ::android::String16& getInterfaceDescriptor() const; \ I##INTERFACE(); \ I##INTERFACE(); \ virtual ~I##INTERFACE(); \ virtual ~I##INTERFACE(); \ static bool setDefaultImpl(std::unique_ptr<I##INTERFACE> impl); \ static const std::unique_ptr<I##INTERFACE>& getDefaultImpl(); \ private: \ static std::unique_ptr<I##INTERFACE> default_impl; \ public: \ #define IMPLEMENT_META_INTERFACE(INTERFACE, NAME) \ #define IMPLEMENT_META_INTERFACE(INTERFACE, NAME) \ Loading @@ -100,6 +106,19 @@ protected: } \ } \ return intr; \ return intr; \ } \ } \ std::unique_ptr<I##INTERFACE> I##INTERFACE::default_impl; \ bool I##INTERFACE::setDefaultImpl(std::unique_ptr<I##INTERFACE> impl)\ { \ if (!I##INTERFACE::default_impl && impl) { \ I##INTERFACE::default_impl = std::move(impl); \ return true; \ } \ return false; \ } \ const std::unique_ptr<I##INTERFACE>& I##INTERFACE::getDefaultImpl() \ { \ return I##INTERFACE::default_impl; \ } \ I##INTERFACE::I##INTERFACE() { } \ I##INTERFACE::I##INTERFACE() { } \ I##INTERFACE::~I##INTERFACE() { } \ I##INTERFACE::~I##INTERFACE() { } \ Loading Loading
libs/binder/include/binder/IInterface.h +19 −0 Original line number Original line Diff line number Diff line Loading @@ -72,12 +72,18 @@ protected: // ---------------------------------------------------------------------- // ---------------------------------------------------------------------- #define DECLARE_META_INTERFACE(INTERFACE) \ #define DECLARE_META_INTERFACE(INTERFACE) \ public: \ static const ::android::String16 descriptor; \ static const ::android::String16 descriptor; \ static ::android::sp<I##INTERFACE> asInterface( \ static ::android::sp<I##INTERFACE> asInterface( \ const ::android::sp<::android::IBinder>& obj); \ const ::android::sp<::android::IBinder>& obj); \ virtual const ::android::String16& getInterfaceDescriptor() const; \ virtual const ::android::String16& getInterfaceDescriptor() const; \ I##INTERFACE(); \ I##INTERFACE(); \ virtual ~I##INTERFACE(); \ virtual ~I##INTERFACE(); \ static bool setDefaultImpl(std::unique_ptr<I##INTERFACE> impl); \ static const std::unique_ptr<I##INTERFACE>& getDefaultImpl(); \ private: \ static std::unique_ptr<I##INTERFACE> default_impl; \ public: \ #define IMPLEMENT_META_INTERFACE(INTERFACE, NAME) \ #define IMPLEMENT_META_INTERFACE(INTERFACE, NAME) \ Loading @@ -100,6 +106,19 @@ protected: } \ } \ return intr; \ return intr; \ } \ } \ std::unique_ptr<I##INTERFACE> I##INTERFACE::default_impl; \ bool I##INTERFACE::setDefaultImpl(std::unique_ptr<I##INTERFACE> impl)\ { \ if (!I##INTERFACE::default_impl && impl) { \ I##INTERFACE::default_impl = std::move(impl); \ return true; \ } \ return false; \ } \ const std::unique_ptr<I##INTERFACE>& I##INTERFACE::getDefaultImpl() \ { \ return I##INTERFACE::default_impl; \ } \ I##INTERFACE::I##INTERFACE() { } \ I##INTERFACE::I##INTERFACE() { } \ I##INTERFACE::~I##INTERFACE() { } \ I##INTERFACE::~I##INTERFACE() { } \ Loading