Optimize BpBinder struct size.
Unnecessary field, and some fields which could be bools. Only shaves off
a few bytes.
Bug: 148177595
Test: boots/works
Change-Id: Iec53d7398d0dc78c0f722e63d650252e769b00ad
diff --git a/libs/binder/BpBinder.cpp b/libs/binder/BpBinder.cpp
index d2b9b8f..cadf15e 100644
--- a/libs/binder/BpBinder.cpp
+++ b/libs/binder/BpBinder.cpp
@@ -139,10 +139,10 @@
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 @@
bool BpBinder::isBinderAlive() const
{
- return mAlive != 0;
+ return mAlive;
}
status_t BpBinder::pingBinder()
@@ -236,7 +236,7 @@
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 @@
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 @@
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 8e871b8..9e8102b 100644
--- a/libs/binder/include/binder/BpBinder.h
+++ b/libs/binder/include/binder/BpBinder.h
@@ -133,13 +133,12 @@
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;