summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2020-03-04 21:18:40 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2020-03-04 21:18:40 +0000
commit62ce7f5ab276acdabcc785f6eee11aa84979f545 (patch)
treec3b6491b4c0d43bb847ad57b0efc0ad39e0d0840
parentc8c27ea6bd1c61db4618aa31ea848bd548f44876 (diff)
parentd6dad7afc088fd5efeedf2cfb701ea531afd1816 (diff)
downloadnative-android10-sidebranch.tar.gz
Merge "Optimize BpBinder struct size." am: d6dad7afc0android10-sidebranch
Change-Id: I5a0161a4df4126284be53d2ea5f0a0b290ace33b
-rw-r--r--libs/binder/BpBinder.cpp14
-rw-r--r--libs/binder/include/binder/BpBinder.h7
2 files changed, 10 insertions, 11 deletions
diff --git a/libs/binder/BpBinder.cpp b/libs/binder/BpBinder.cpp
index d2b9b8f018..cadf15ef28 100644
--- a/libs/binder/BpBinder.cpp
+++ b/libs/binder/BpBinder.cpp
@@ -139,10 +139,10 @@ BpBinder* BpBinder::create(int32_t handle) {
BpBinder::BpBinder(int32_t handle, int32_t trackedUid)
: mHandle(handle)
, mStability(0)
- , mAlive(1)
- , mObitsSent(0)
- , mObituaries(nullptr)
, mTrackedUid(trackedUid)
+ , mAlive(true)
+ , mObitsSent(false)
+ , mObituaries(nullptr)
{
ALOGV("Creating BpBinder %p handle %d\n", this, mHandle);
@@ -185,7 +185,7 @@ const String16& BpBinder::getInterfaceDescriptor() const
bool BpBinder::isBinderAlive() const
{
- return mAlive != 0;
+ return mAlive;
}
status_t BpBinder::pingBinder()
@@ -236,7 +236,7 @@ status_t BpBinder::transact(
status_t status = IPCThreadState::self()->transact(
mHandle, code, data, reply, flags);
- if (status == DEAD_OBJECT) mAlive = 0;
+ if (status == DEAD_OBJECT) mAlive = false;
return status;
}
@@ -320,7 +320,7 @@ void BpBinder::sendObituary()
ALOGV("Sending obituary for proxy %p handle %d, mObitsSent=%s\n",
this, mHandle, mObitsSent ? "true" : "false");
- mAlive = 0;
+ mAlive = false;
if (mObitsSent) return;
mLock.lock();
@@ -332,7 +332,7 @@ void BpBinder::sendObituary()
self->flushCommands();
mObituaries = nullptr;
}
- mObitsSent = 1;
+ mObitsSent = true;
mLock.unlock();
ALOGV("Reporting death of proxy %p for %zu recipients\n",
diff --git a/libs/binder/include/binder/BpBinder.h b/libs/binder/include/binder/BpBinder.h
index 8e871b8214..9e8102b25a 100644
--- a/libs/binder/include/binder/BpBinder.h
+++ b/libs/binder/include/binder/BpBinder.h
@@ -133,13 +133,12 @@ private:
bool isDescriptorCached() const;
mutable Mutex mLock;
- volatile int32_t mAlive;
- volatile int32_t mObitsSent;
+ int32_t mTrackedUid;
+ volatile bool mAlive;
+ volatile bool mObitsSent;
Vector<Obituary>* mObituaries;
ObjectManager mObjects;
- Parcel* mConstantData;
mutable String16 mDescriptorCache;
- int32_t mTrackedUid;
static Mutex sTrackingLock;
static std::unordered_map<int32_t,uint32_t> sTrackingMap;