Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 76c0aa44 authored by Steven Moreland's avatar Steven Moreland
Browse files

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
parent a7fb0186
Loading
Loading
Loading
Loading
+7 −7
Original line number Original line Diff line number Diff line
@@ -139,10 +139,10 @@ BpBinder* BpBinder::create(int32_t handle) {
BpBinder::BpBinder(int32_t handle, int32_t trackedUid)
BpBinder::BpBinder(int32_t handle, int32_t trackedUid)
    : mHandle(handle)
    : mHandle(handle)
    , mStability(0)
    , mStability(0)
    , mAlive(1)
    , mObitsSent(0)
    , mObituaries(nullptr)
    , mTrackedUid(trackedUid)
    , mTrackedUid(trackedUid)
    , mAlive(true)
    , mObitsSent(false)
    , mObituaries(nullptr)
{
{
    ALOGV("Creating BpBinder %p handle %d\n", this, mHandle);
    ALOGV("Creating BpBinder %p handle %d\n", this, mHandle);


@@ -185,7 +185,7 @@ const String16& BpBinder::getInterfaceDescriptor() const


bool BpBinder::isBinderAlive() const
bool BpBinder::isBinderAlive() const
{
{
    return mAlive != 0;
    return mAlive;
}
}


status_t BpBinder::pingBinder()
status_t BpBinder::pingBinder()
@@ -236,7 +236,7 @@ status_t BpBinder::transact(


        status_t status = IPCThreadState::self()->transact(
        status_t status = IPCThreadState::self()->transact(
            mHandle, code, data, reply, flags);
            mHandle, code, data, reply, flags);
        if (status == DEAD_OBJECT) mAlive = 0;
        if (status == DEAD_OBJECT) mAlive = false;


        return status;
        return status;
    }
    }
@@ -320,7 +320,7 @@ void BpBinder::sendObituary()
    ALOGV("Sending obituary for proxy %p handle %d, mObitsSent=%s\n",
    ALOGV("Sending obituary for proxy %p handle %d, mObitsSent=%s\n",
        this, mHandle, mObitsSent ? "true" : "false");
        this, mHandle, mObitsSent ? "true" : "false");


    mAlive = 0;
    mAlive = false;
    if (mObitsSent) return;
    if (mObitsSent) return;


    mLock.lock();
    mLock.lock();
@@ -332,7 +332,7 @@ void BpBinder::sendObituary()
        self->flushCommands();
        self->flushCommands();
        mObituaries = nullptr;
        mObituaries = nullptr;
    }
    }
    mObitsSent = 1;
    mObitsSent = true;
    mLock.unlock();
    mLock.unlock();


    ALOGV("Reporting death of proxy %p for %zu recipients\n",
    ALOGV("Reporting death of proxy %p for %zu recipients\n",
+3 −4
Original line number Original line Diff line number Diff line
@@ -133,13 +133,12 @@ private:
            bool                isDescriptorCached() const;
            bool                isDescriptorCached() const;


    mutable Mutex               mLock;
    mutable Mutex               mLock;
            volatile int32_t    mAlive;
            int32_t             mTrackedUid;
            volatile int32_t    mObitsSent;
            volatile bool       mAlive;
            volatile bool       mObitsSent;
            Vector<Obituary>*   mObituaries;
            Vector<Obituary>*   mObituaries;
            ObjectManager       mObjects;
            ObjectManager       mObjects;
            Parcel*             mConstantData;
    mutable String16            mDescriptorCache;
    mutable String16            mDescriptorCache;
            int32_t             mTrackedUid;


    static Mutex                                sTrackingLock;
    static Mutex                                sTrackingLock;
    static std::unordered_map<int32_t,uint32_t> sTrackingMap;
    static std::unordered_map<int32_t,uint32_t> sTrackingMap;