diff options
author | Mathias Agopian <mathias@google.com> | 2009-05-27 14:34:50 -0700 |
---|---|---|
committer | Mathias Agopian <mathias@google.com> | 2009-05-27 14:34:50 -0700 |
commit | 2da99bdaa1712f00525e6a84b58044332cb1baef (patch) | |
tree | ed330500de06dc645769ea87372fb624390b52a8 /include/binder | |
parent | 947f4f4d384ea26eb2145cc070a3eed42c59534a (diff) | |
parent | cc77841f643751fd9f128e90f7d1587445ef353e (diff) | |
download | frameworks_base-2da99bdaa1712f00525e6a84b58044332cb1baef.zip frameworks_base-2da99bdaa1712f00525e6a84b58044332cb1baef.tar.gz frameworks_base-2da99bdaa1712f00525e6a84b58044332cb1baef.tar.bz2 |
Merge commit 'goog/master' into merge_master
Conflicts:
include/ui/Rect.h
libs/ui/ISurfaceComposer.cpp
Diffstat (limited to 'include/binder')
-rw-r--r-- | include/binder/Binder.h | 3 | ||||
-rw-r--r-- | include/binder/BpBinder.h | 4 | ||||
-rw-r--r-- | include/binder/IBinder.h | 6 | ||||
-rw-r--r-- | include/binder/IInterface.h | 24 | ||||
-rw-r--r-- | include/binder/IMemory.h | 8 | ||||
-rw-r--r-- | include/binder/MemoryDealer.h | 9 | ||||
-rw-r--r-- | include/binder/Parcel.h | 5 |
7 files changed, 46 insertions, 13 deletions
diff --git a/include/binder/Binder.h b/include/binder/Binder.h index c9b71fd..47b2bb9 100644 --- a/include/binder/Binder.h +++ b/include/binder/Binder.h @@ -27,7 +27,7 @@ class BBinder : public IBinder public: BBinder(); - virtual String16 getInterfaceDescriptor() const; + virtual const String16& getInterfaceDescriptor() const; virtual bool isBinderAlive() const; virtual status_t pingBinder(); virtual status_t dump(int fd, const Vector<String16>& args); @@ -71,6 +71,7 @@ private: Extras* mExtras; void* mReserved0; + static String16 sEmptyDescriptor; }; // --------------------------------------------------------------------------- diff --git a/include/binder/BpBinder.h b/include/binder/BpBinder.h index 067637e..7ef93aa 100644 --- a/include/binder/BpBinder.h +++ b/include/binder/BpBinder.h @@ -31,7 +31,7 @@ public: inline int32_t handle() const { return mHandle; } - virtual String16 getInterfaceDescriptor() const; + virtual const String16& getInterfaceDescriptor() const; virtual bool isBinderAlive() const; virtual status_t pingBinder(); virtual status_t dump(int fd, const Vector<String16>& args); @@ -106,6 +106,7 @@ private: }; void reportOneDeath(const Obituary& obit); + bool isDescriptorCached() const; mutable Mutex mLock; volatile int32_t mAlive; @@ -113,6 +114,7 @@ private: Vector<Obituary>* mObituaries; ObjectManager mObjects; Parcel* mConstantData; + mutable String16 mDescriptorCache; }; }; // namespace android diff --git a/include/binder/IBinder.h b/include/binder/IBinder.h index 7370330..884b5c1 100644 --- a/include/binder/IBinder.h +++ b/include/binder/IBinder.h @@ -56,7 +56,7 @@ public: FLAG_ONEWAY = 0x00000001 }; - inline IBinder() { } + IBinder(); /** * Check if this IBinder implements the interface named by @@ -69,7 +69,7 @@ public: * Return the canonical name of the interface provided by this IBinder * object. */ - virtual String16 getInterfaceDescriptor() const = 0; + virtual const String16& getInterfaceDescriptor() const = 0; virtual bool isBinderAlive() const = 0; virtual status_t pingBinder() = 0; @@ -147,7 +147,7 @@ public: virtual BpBinder* remoteBinder(); protected: - inline virtual ~IBinder() { } + virtual ~IBinder(); private: }; diff --git a/include/binder/IInterface.h b/include/binder/IInterface.h index 3b1e33b..273d922 100644 --- a/include/binder/IInterface.h +++ b/include/binder/IInterface.h @@ -27,10 +27,12 @@ namespace android { class IInterface : public virtual RefBase { public: + IInterface(); sp<IBinder> asBinder(); sp<const IBinder> asBinder() const; - + protected: + virtual ~IInterface(); virtual IBinder* onAsBinder() = 0; }; @@ -49,7 +51,7 @@ class BnInterface : public INTERFACE, public BBinder { public: virtual sp<IInterface> queryLocalInterface(const String16& _descriptor); - virtual String16 getInterfaceDescriptor() const; + virtual const String16& getInterfaceDescriptor() const; protected: virtual IBinder* onAsBinder(); @@ -72,11 +74,14 @@ protected: #define DECLARE_META_INTERFACE(INTERFACE) \ static const String16 descriptor; \ static sp<I##INTERFACE> asInterface(const sp<IBinder>& obj); \ - virtual String16 getInterfaceDescriptor() const; \ + virtual const String16& getInterfaceDescriptor() const; \ + I##INTERFACE(); \ + virtual ~I##INTERFACE(); \ + #define IMPLEMENT_META_INTERFACE(INTERFACE, NAME) \ const String16 I##INTERFACE::descriptor(NAME); \ - String16 I##INTERFACE::getInterfaceDescriptor() const { \ + const String16& I##INTERFACE::getInterfaceDescriptor() const { \ return I##INTERFACE::descriptor; \ } \ sp<I##INTERFACE> I##INTERFACE::asInterface(const sp<IBinder>& obj) \ @@ -92,9 +97,16 @@ protected: } \ return intr; \ } \ + I##INTERFACE::I##INTERFACE() { } \ + I##INTERFACE::~I##INTERFACE() { } \ + + +#define CHECK_INTERFACE(interface, data, reply) \ + if (!data.checkInterface(this)) { return PERMISSION_DENIED; } \ + // ---------------------------------------------------------------------- -// No user-servicable parts after this... +// No user-serviceable parts after this... template<typename INTERFACE> inline sp<IInterface> BnInterface<INTERFACE>::queryLocalInterface( @@ -105,7 +117,7 @@ inline sp<IInterface> BnInterface<INTERFACE>::queryLocalInterface( } template<typename INTERFACE> -inline String16 BnInterface<INTERFACE>::getInterfaceDescriptor() const +inline const String16& BnInterface<INTERFACE>::getInterfaceDescriptor() const { return INTERFACE::getInterfaceDescriptor(); } diff --git a/include/binder/IMemory.h b/include/binder/IMemory.h index 182792c..ae042cb 100644 --- a/include/binder/IMemory.h +++ b/include/binder/IMemory.h @@ -59,6 +59,10 @@ public: const Parcel& data, Parcel* reply, uint32_t flags = 0); + + BnMemoryHeap(); +protected: + virtual ~BnMemoryHeap(); }; // ---------------------------------------------------------------------------- @@ -85,6 +89,10 @@ public: const Parcel& data, Parcel* reply, uint32_t flags = 0); + + BnMemory(); +protected: + virtual ~BnMemory(); }; // ---------------------------------------------------------------------------- diff --git a/include/binder/MemoryDealer.h b/include/binder/MemoryDealer.h index 2080ea6..6628f75 100644 --- a/include/binder/MemoryDealer.h +++ b/include/binder/MemoryDealer.h @@ -39,6 +39,10 @@ class HeapInterface : public virtual BnMemoryHeap public: // all values must be page-aligned virtual sp<IMemory> mapMemory(size_t offset, size_t size) = 0; + + HeapInterface(); +protected: + virtual ~HeapInterface(); }; // ---------------------------------------------------------------------------- @@ -61,6 +65,10 @@ public: virtual void dump(const char* what, uint32_t flags = 0) const = 0; virtual void dump(String8& res, const char* what, uint32_t flags = 0) const = 0; + + AllocatorInterface(); +protected: + virtual ~AllocatorInterface(); }; // ---------------------------------------------------------------------------- @@ -71,6 +79,7 @@ public: class SharedHeap : public HeapInterface, public MemoryHeapBase { public: + SharedHeap(); SharedHeap(size_t size, uint32_t flags = 0, char const * name = NULL); virtual ~SharedHeap(); virtual sp<IMemory> mapMemory(size_t offset, size_t size); diff --git a/include/binder/Parcel.h b/include/binder/Parcel.h index af1490a..58c2d9a 100644 --- a/include/binder/Parcel.h +++ b/include/binder/Parcel.h @@ -57,7 +57,8 @@ public: status_t writeInterfaceToken(const String16& interface); bool enforceInterface(const String16& interface) const; - + bool checkInterface(IBinder*) const; + void freeData(); const size_t* objects() const; @@ -147,7 +148,7 @@ public: release_func relFunc, void* relCookie); void print(TextOutput& to, uint32_t flags = 0) const; - + private: Parcel(const Parcel& o); Parcel& operator=(const Parcel& o); |