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

Commit d62b371d authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Minor style improvements + moves" into main

parents 5cb69a38 a4fa62ea
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -135,7 +135,7 @@ os::ServiceWithMetadata createServiceWithMetadata(const sp<IBinder>& service, bo
    return out;
}

bool BinderCacheWithInvalidation::isClientSideCachingEnabled(const std::string& serviceName) {
bool BinderCacheWithInvalidation::isClientSideCachingEnabled(const std::string& serviceName) const {
    sp<ProcessState> self = ProcessState::selfOrNull();
    // Should not cache if process state could not be found, or if thread pool
    // max could is not greater than zero.
+5 −5
Original line number Diff line number Diff line
@@ -29,7 +29,7 @@ class BinderCacheWithInvalidation
    class BinderInvalidation : public IBinder::DeathRecipient {
    public:
        BinderInvalidation(std::weak_ptr<BinderCacheWithInvalidation> cache, const std::string& key)
              : mCache(cache), mKey(key) {}
              : mCache(std::move(cache)), mKey(key) {}

        void binderDied(const wp<IBinder>& who) override {
            sp<IBinder> binder = who.promote();
@@ -73,7 +73,7 @@ public:
                if (result != DEAD_OBJECT) {
                    ALOGW("Unlinking to dead binder resulted in: %d", result);
                }
                mCache.erase(key);
                mCache.erase(it);
                return true;
            }
        }
@@ -105,14 +105,14 @@ public:
        binder::ScopedTrace aidlTrace(ATRACE_TAG_AIDL,
                                      "BinderCacheWithInvalidation::setItem Successfully Cached");
        std::lock_guard<std::mutex> lock(mCacheMutex);
        mCache[key] = {.service = item, .deathRecipient = deathRecipient};
        mCache[key] = {.service = item, .deathRecipient = std::move(deathRecipient)};
        return binder::Status::ok();
    }

    bool isClientSideCachingEnabled(const std::string& serviceName);
    bool isClientSideCachingEnabled(const std::string& serviceName) const;

private:
    std::map<std::string, Entry> mCache;
    std::map<std::string, Entry, std::less<>> mCache;
    mutable std::mutex mCacheMutex;
};