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

Commit f5f5c77f authored by Devin Moore's avatar Devin Moore
Browse files

Remove the ObjectManager::kill() function

It's an unnecessary layer.

Test: m
Bug: 388120087
Change-Id: I10b0025bb816f7c18ffdc0fd3007b4bfb3ac1fda
parent 3fea46fd
Loading
Loading
Loading
Loading
+10 −15
Original line number Diff line number Diff line
@@ -78,7 +78,16 @@ BpBinder::ObjectManager::ObjectManager()

BpBinder::ObjectManager::~ObjectManager()
{
    kill();
    const size_t N = mObjects.size();
    ALOGV("Killing %zu objects in manager %p", N, this);
    for (auto i : mObjects) {
        const entry_t& e = i.second;
        if (e.func != nullptr) {
            e.func(i.first, e.object, e.cleanupCookie);
        }
    }

    mObjects.clear();
}

void* BpBinder::ObjectManager::attach(const void* objectID, void* object, void* cleanupCookie,
@@ -144,20 +153,6 @@ sp<IBinder> BpBinder::ObjectManager::lookupOrCreateWeak(const void* objectID, ob
    return newObj;
}

void BpBinder::ObjectManager::kill()
{
    const size_t N = mObjects.size();
    ALOGV("Killing %zu objects in manager %p", N, this);
    for (auto i : mObjects) {
        const entry_t& e = i.second;
        if (e.func != nullptr) {
            e.func(i.first, e.object, e.cleanupCookie);
        }
    }

    mObjects.clear();
}

// ---------------------------------------------------------------------------

sp<BpBinder> BpBinder::create(int32_t handle, std::function<void()>* postTask) {
+1 −2
Original line number Diff line number Diff line
@@ -104,6 +104,7 @@ public:
    // Stop the current recording.
    LIBBINDER_EXPORTED status_t stopRecordingBinder();

    // Note: This class is not thread safe so protect uses of it when necessary
    class ObjectManager {
    public:
        ObjectManager();
@@ -116,8 +117,6 @@ public:
        sp<IBinder> lookupOrCreateWeak(const void* objectID, IBinder::object_make_func make,
                                       const void* makeArgs);

        void kill();

    private:
        ObjectManager(const ObjectManager&);
        ObjectManager& operator=(const ObjectManager&);