Loading libs/binder/Parcel.cpp +31 −23 Original line number Diff line number Diff line Loading @@ -17,40 +17,42 @@ #define LOG_TAG "Parcel" //#define LOG_NDEBUG 0 #include <binder/Parcel.h> #include <errno.h> #include <inttypes.h> #include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <sys/mman.h> #include <sys/stat.h> #include <sys/types.h> #include <unistd.h> #include <binder/IPCThreadState.h> #include <binder/Binder.h> #include <binder/BpBinder.h> #include <binder/IPCThreadState.h> #include <binder/Parcel.h> #include <binder/ProcessState.h> #include <binder/TextOutput.h> #include <errno.h> #include <cutils/ashmem.h> #include <utils/Debug.h> #include <utils/Flattenable.h> #include <utils/Log.h> #include <utils/misc.h> #include <utils/String8.h> #include <utils/String16.h> #include <utils/misc.h> #include <utils/Flattenable.h> #include <cutils/ashmem.h> #include <private/binder/binder_module.h> #include <private/binder/Static.h> #include <inttypes.h> #include <stdio.h> #include <stdlib.h> #include <stdint.h> #include <sys/mman.h> #ifndef INT32_MAX #define INT32_MAX ((int32_t)(2147483647)) #endif #define LOG_REFS(...) //#define LOG_REFS(...) ALOG(LOG_DEBUG, "Parcel", __VA_ARGS__) //#define LOG_REFS(...) ALOG(LOG_DEBUG, LOG_TAG, __VA_ARGS__) #define LOG_ALLOC(...) //#define LOG_ALLOC(...) ALOG(LOG_DEBUG, "Parcel", __VA_ARGS__) //#define LOG_ALLOC(...) ALOG(LOG_DEBUG, LOG_TAG, __VA_ARGS__) // --------------------------------------------------------------------------- Loading Loading @@ -123,8 +125,10 @@ void acquire_object(const sp<ProcessState>& proc, return; } case BINDER_TYPE_FD: { if (obj.cookie != 0) { if (outAshmemSize != NULL) { if ((obj.cookie != 0) && (outAshmemSize != NULL)) { struct stat st; int ret = fstat(obj.handle, &st); if (!ret && S_ISCHR(st.st_mode)) { // 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) { Loading Loading @@ -173,16 +177,20 @@ static void release_object(const sp<ProcessState>& proc, return; } case BINDER_TYPE_FD: { if (obj.cookie != 0) { // owned if (outAshmemSize != NULL) { if (obj.cookie != 0) { struct stat st; int ret = fstat(obj.handle, &st); if (!ret && S_ISCHR(st.st_mode)) { int size = ashmem_get_size_region(obj.handle); if (size > 0) { *outAshmemSize -= size; } } } close(obj.handle); } } return; } } Loading Loading
libs/binder/Parcel.cpp +31 −23 Original line number Diff line number Diff line Loading @@ -17,40 +17,42 @@ #define LOG_TAG "Parcel" //#define LOG_NDEBUG 0 #include <binder/Parcel.h> #include <errno.h> #include <inttypes.h> #include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <sys/mman.h> #include <sys/stat.h> #include <sys/types.h> #include <unistd.h> #include <binder/IPCThreadState.h> #include <binder/Binder.h> #include <binder/BpBinder.h> #include <binder/IPCThreadState.h> #include <binder/Parcel.h> #include <binder/ProcessState.h> #include <binder/TextOutput.h> #include <errno.h> #include <cutils/ashmem.h> #include <utils/Debug.h> #include <utils/Flattenable.h> #include <utils/Log.h> #include <utils/misc.h> #include <utils/String8.h> #include <utils/String16.h> #include <utils/misc.h> #include <utils/Flattenable.h> #include <cutils/ashmem.h> #include <private/binder/binder_module.h> #include <private/binder/Static.h> #include <inttypes.h> #include <stdio.h> #include <stdlib.h> #include <stdint.h> #include <sys/mman.h> #ifndef INT32_MAX #define INT32_MAX ((int32_t)(2147483647)) #endif #define LOG_REFS(...) //#define LOG_REFS(...) ALOG(LOG_DEBUG, "Parcel", __VA_ARGS__) //#define LOG_REFS(...) ALOG(LOG_DEBUG, LOG_TAG, __VA_ARGS__) #define LOG_ALLOC(...) //#define LOG_ALLOC(...) ALOG(LOG_DEBUG, "Parcel", __VA_ARGS__) //#define LOG_ALLOC(...) ALOG(LOG_DEBUG, LOG_TAG, __VA_ARGS__) // --------------------------------------------------------------------------- Loading Loading @@ -123,8 +125,10 @@ void acquire_object(const sp<ProcessState>& proc, return; } case BINDER_TYPE_FD: { if (obj.cookie != 0) { if (outAshmemSize != NULL) { if ((obj.cookie != 0) && (outAshmemSize != NULL)) { struct stat st; int ret = fstat(obj.handle, &st); if (!ret && S_ISCHR(st.st_mode)) { // 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) { Loading Loading @@ -173,16 +177,20 @@ static void release_object(const sp<ProcessState>& proc, return; } case BINDER_TYPE_FD: { if (obj.cookie != 0) { // owned if (outAshmemSize != NULL) { if (obj.cookie != 0) { struct stat st; int ret = fstat(obj.handle, &st); if (!ret && S_ISCHR(st.st_mode)) { int size = ashmem_get_size_region(obj.handle); if (size > 0) { *outAshmemSize -= size; } } } close(obj.handle); } } return; } } Loading