Loading include/binder/Parcel.h +4 −2 Original line number Diff line number Diff line Loading @@ -342,9 +342,11 @@ public: private: size_t mBlobAshmemSize; size_t mOpenAshmemSize; public: size_t getBlobAshmemSize() const; size_t getOpenAshmemSize() const; }; // --------------------------------------------------------------------------- Loading Loading @@ -412,9 +414,9 @@ inline TextOutput& operator<<(TextOutput& to, const Parcel& parcel) // Generic acquire and release of objects. void acquire_object(const sp<ProcessState>& proc, const flat_binder_object& obj, const void* who); const flat_binder_object& obj, const void* who, size_t* outAshmemSize); void release_object(const sp<ProcessState>& proc, const flat_binder_object& obj, const void* who); const flat_binder_object& obj, const void* who, size_t* outAshmemSize); void flatten_binder(const sp<ProcessState>& proc, const sp<IBinder>& binder, flat_binder_object* out); Loading libs/binder/Parcel.cpp +28 −10 Original line number Diff line number Diff line Loading @@ -96,7 +96,7 @@ enum { }; void acquire_object(const sp<ProcessState>& proc, const flat_binder_object& obj, const void* who) const flat_binder_object& obj, const void* who, size_t* outAshmemSize) { switch (obj.type) { case BINDER_TYPE_BINDER: Loading @@ -123,8 +123,13 @@ void acquire_object(const sp<ProcessState>& proc, return; } case BINDER_TYPE_FD: { // intentionally blank -- nothing to do to acquire this, but we do // recognize it as a legitimate object type. if (obj.cookie != 0) { // If we own an ashmem fd, keep track of how much memory it refers to. int size = ashmem_get_size_region(obj.handle); if (size > 0) { *outAshmemSize += size; } } return; } } Loading @@ -133,7 +138,7 @@ void acquire_object(const sp<ProcessState>& proc, } void release_object(const sp<ProcessState>& proc, const flat_binder_object& obj, const void* who) const flat_binder_object& obj, const void* who, size_t* outAshmemSize) { switch (obj.type) { case BINDER_TYPE_BINDER: Loading @@ -160,7 +165,14 @@ void release_object(const sp<ProcessState>& proc, return; } case BINDER_TYPE_FD: { if (obj.cookie != 0) close(obj.handle); if (obj.cookie != 0) { int size = ashmem_get_size_region(obj.handle); if (size > 0) { *outAshmemSize -= size; } close(obj.handle); } return; } } Loading Loading @@ -504,7 +516,7 @@ status_t Parcel::appendFrom(const Parcel *parcel, size_t offset, size_t len) flat_binder_object* flat = reinterpret_cast<flat_binder_object*>(mData + off); acquire_object(proc, *flat, this); acquire_object(proc, *flat, this, &mOpenAshmemSize); if (flat->type == BINDER_TYPE_FD) { // If this is a file descriptor, we need to dup it so the Loading Loading @@ -1026,7 +1038,7 @@ restart_write: // Need to write meta-data? if (nullMetaData || val.binder != 0) { mObjects[mObjectsSize] = mDataPos; acquire_object(ProcessState::self(), val, this); acquire_object(ProcessState::self(), val, this, &mOpenAshmemSize); mObjectsSize++; } Loading Loading @@ -1609,7 +1621,7 @@ void Parcel::releaseObjects() i--; const flat_binder_object* flat = reinterpret_cast<flat_binder_object*>(data+objects[i]); release_object(proc, *flat, this); release_object(proc, *flat, this, &mOpenAshmemSize); } } Loading @@ -1623,7 +1635,7 @@ void Parcel::acquireObjects() i--; const flat_binder_object* flat = reinterpret_cast<flat_binder_object*>(data+objects[i]); acquire_object(proc, *flat, this); acquire_object(proc, *flat, this, &mOpenAshmemSize); } } Loading Loading @@ -1805,7 +1817,7 @@ status_t Parcel::continueWrite(size_t desired) // will need to rescan because we may have lopped off the only FDs mFdsKnown = false; } release_object(proc, *flat, this); release_object(proc, *flat, this, &mOpenAshmemSize); } binder_size_t* objects = (binder_size_t*)realloc(mObjects, objectsSize*sizeof(binder_size_t)); Loading Loading @@ -1891,6 +1903,7 @@ void Parcel::initState() mAllowFds = true; mOwner = NULL; mBlobAshmemSize = 0; mOpenAshmemSize = 0; } void Parcel::scanForFds() const Loading @@ -1913,6 +1926,11 @@ size_t Parcel::getBlobAshmemSize() const return mBlobAshmemSize; } size_t Parcel::getOpenAshmemSize() const { return mOpenAshmemSize; } // --- Parcel::Blob --- Parcel::Blob::Blob() : Loading Loading
include/binder/Parcel.h +4 −2 Original line number Diff line number Diff line Loading @@ -342,9 +342,11 @@ public: private: size_t mBlobAshmemSize; size_t mOpenAshmemSize; public: size_t getBlobAshmemSize() const; size_t getOpenAshmemSize() const; }; // --------------------------------------------------------------------------- Loading Loading @@ -412,9 +414,9 @@ inline TextOutput& operator<<(TextOutput& to, const Parcel& parcel) // Generic acquire and release of objects. void acquire_object(const sp<ProcessState>& proc, const flat_binder_object& obj, const void* who); const flat_binder_object& obj, const void* who, size_t* outAshmemSize); void release_object(const sp<ProcessState>& proc, const flat_binder_object& obj, const void* who); const flat_binder_object& obj, const void* who, size_t* outAshmemSize); void flatten_binder(const sp<ProcessState>& proc, const sp<IBinder>& binder, flat_binder_object* out); Loading
libs/binder/Parcel.cpp +28 −10 Original line number Diff line number Diff line Loading @@ -96,7 +96,7 @@ enum { }; void acquire_object(const sp<ProcessState>& proc, const flat_binder_object& obj, const void* who) const flat_binder_object& obj, const void* who, size_t* outAshmemSize) { switch (obj.type) { case BINDER_TYPE_BINDER: Loading @@ -123,8 +123,13 @@ void acquire_object(const sp<ProcessState>& proc, return; } case BINDER_TYPE_FD: { // intentionally blank -- nothing to do to acquire this, but we do // recognize it as a legitimate object type. if (obj.cookie != 0) { // If we own an ashmem fd, keep track of how much memory it refers to. int size = ashmem_get_size_region(obj.handle); if (size > 0) { *outAshmemSize += size; } } return; } } Loading @@ -133,7 +138,7 @@ void acquire_object(const sp<ProcessState>& proc, } void release_object(const sp<ProcessState>& proc, const flat_binder_object& obj, const void* who) const flat_binder_object& obj, const void* who, size_t* outAshmemSize) { switch (obj.type) { case BINDER_TYPE_BINDER: Loading @@ -160,7 +165,14 @@ void release_object(const sp<ProcessState>& proc, return; } case BINDER_TYPE_FD: { if (obj.cookie != 0) close(obj.handle); if (obj.cookie != 0) { int size = ashmem_get_size_region(obj.handle); if (size > 0) { *outAshmemSize -= size; } close(obj.handle); } return; } } Loading Loading @@ -504,7 +516,7 @@ status_t Parcel::appendFrom(const Parcel *parcel, size_t offset, size_t len) flat_binder_object* flat = reinterpret_cast<flat_binder_object*>(mData + off); acquire_object(proc, *flat, this); acquire_object(proc, *flat, this, &mOpenAshmemSize); if (flat->type == BINDER_TYPE_FD) { // If this is a file descriptor, we need to dup it so the Loading Loading @@ -1026,7 +1038,7 @@ restart_write: // Need to write meta-data? if (nullMetaData || val.binder != 0) { mObjects[mObjectsSize] = mDataPos; acquire_object(ProcessState::self(), val, this); acquire_object(ProcessState::self(), val, this, &mOpenAshmemSize); mObjectsSize++; } Loading Loading @@ -1609,7 +1621,7 @@ void Parcel::releaseObjects() i--; const flat_binder_object* flat = reinterpret_cast<flat_binder_object*>(data+objects[i]); release_object(proc, *flat, this); release_object(proc, *flat, this, &mOpenAshmemSize); } } Loading @@ -1623,7 +1635,7 @@ void Parcel::acquireObjects() i--; const flat_binder_object* flat = reinterpret_cast<flat_binder_object*>(data+objects[i]); acquire_object(proc, *flat, this); acquire_object(proc, *flat, this, &mOpenAshmemSize); } } Loading Loading @@ -1805,7 +1817,7 @@ status_t Parcel::continueWrite(size_t desired) // will need to rescan because we may have lopped off the only FDs mFdsKnown = false; } release_object(proc, *flat, this); release_object(proc, *flat, this, &mOpenAshmemSize); } binder_size_t* objects = (binder_size_t*)realloc(mObjects, objectsSize*sizeof(binder_size_t)); Loading Loading @@ -1891,6 +1903,7 @@ void Parcel::initState() mAllowFds = true; mOwner = NULL; mBlobAshmemSize = 0; mOpenAshmemSize = 0; } void Parcel::scanForFds() const Loading @@ -1913,6 +1926,11 @@ size_t Parcel::getBlobAshmemSize() const return mBlobAshmemSize; } size_t Parcel::getOpenAshmemSize() const { return mOpenAshmemSize; } // --- Parcel::Blob --- Parcel::Blob::Blob() : Loading