summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2015-12-10 21:15:19 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2015-12-10 21:15:19 +0000
commitb25116f735e00467057085c18a984aca0cc93a84 (patch)
tree43202577ca08d245044b03fd4f24ee23a6a54656
parentdff3651eed393f4a6e7b5fcbea1d91de981e91a0 (diff)
parent83ec65e19a8b5e1ae11e789b3d79d08543b09193 (diff)
downloadnative-b25116f735e00467057085c18a984aca0cc93a84.tar.gz
Merge "Fix allocation count"
-rw-r--r--libs/binder/Parcel.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/libs/binder/Parcel.cpp b/libs/binder/Parcel.cpp
index 0beea33cee..3abb44f6aa 100644
--- a/libs/binder/Parcel.cpp
+++ b/libs/binder/Parcel.cpp
@@ -1989,6 +1989,9 @@ status_t Parcel::restartWrite(size_t desired)
pthread_mutex_lock(&gParcelGlobalAllocSizeLock);
gParcelGlobalAllocSize += desired;
gParcelGlobalAllocSize -= mDataCapacity;
+ if (!mData) {
+ gParcelGlobalAllocCount++;
+ }
pthread_mutex_unlock(&gParcelGlobalAllocSizeLock);
mData = data;
mDataCapacity = desired;
@@ -2120,7 +2123,6 @@ status_t Parcel::continueWrite(size_t desired)
pthread_mutex_lock(&gParcelGlobalAllocSizeLock);
gParcelGlobalAllocSize += desired;
gParcelGlobalAllocSize -= mDataCapacity;
- gParcelGlobalAllocCount++;
pthread_mutex_unlock(&gParcelGlobalAllocSizeLock);
mData = data;
mDataCapacity = desired;