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

Commit 7bd4f6f4 authored by Glenn Kasten's avatar Glenn Kasten Committed by Android (Google) Code Review
Browse files

Merge "For performance, return large objects by reference"

parents 22152a68 9704026c
Loading
Loading
Loading
Loading
+6 −7
Original line number Original line Diff line number Diff line
@@ -7561,7 +7561,8 @@ void AudioFlinger::EffectChain::setEffectSuspendedAll_l(bool suspend)
            ALOGV("setEffectSuspendedAll_l() add entry for 0");
            ALOGV("setEffectSuspendedAll_l() add entry for 0");
        }
        }
        if (desc->mRefCount++ == 0) {
        if (desc->mRefCount++ == 0) {
            Vector< sp<EffectModule> > effects = getSuspendEligibleEffects();
            Vector< sp<EffectModule> > effects;
            getSuspendEligibleEffects(effects);
            for (size_t i = 0; i < effects.size(); i++) {
            for (size_t i = 0; i < effects.size(); i++) {
                setEffectSuspended_l(&effects[i]->desc().type, true);
                setEffectSuspended_l(&effects[i]->desc().type, true);
            }
            }
@@ -7612,16 +7613,14 @@ bool AudioFlinger::EffectChain::isEffectEligibleForSuspend(const effect_descript
    return true;
    return true;
}
}


Vector< sp<AudioFlinger::EffectModule> > AudioFlinger::EffectChain::getSuspendEligibleEffects()
void AudioFlinger::EffectChain::getSuspendEligibleEffects(Vector< sp<AudioFlinger::EffectModule> > &effects)
{
{
    Vector< sp<EffectModule> > effects;
    effects.clear();
    for (size_t i = 0; i < mEffects.size(); i++) {
    for (size_t i = 0; i < mEffects.size(); i++) {
        if (!isEffectEligibleForSuspend(mEffects[i]->desc())) {
        if (isEffectEligibleForSuspend(mEffects[i]->desc())) {
            continue;
        }
            effects.add(mEffects[i]);
            effects.add(mEffects[i]);
        }
        }
    return effects;
    }
}
}


sp<AudioFlinger::EffectModule> AudioFlinger::EffectChain::getEffectIfEnabled(
sp<AudioFlinger::EffectModule> AudioFlinger::EffectChain::getEffectIfEnabled(
+2 −1
Original line number Original line Diff line number Diff line
@@ -1327,7 +1327,8 @@ mutable Mutex mLock; // mutex for process, commands and handl


        // get a list of effect modules to suspend when an effect of the type
        // get a list of effect modules to suspend when an effect of the type
        // passed is enabled.
        // passed is enabled.
        Vector< sp<EffectModule> > getSuspendEligibleEffects();
        void                       getSuspendEligibleEffects(Vector< sp<EffectModule> > &effects);

        // get an effect module if it is currently enable
        // get an effect module if it is currently enable
        sp<EffectModule> getEffectIfEnabled(const effect_uuid_t *type);
        sp<EffectModule> getEffectIfEnabled(const effect_uuid_t *type);
        // true if the effect whose descriptor is passed can be suspended
        // true if the effect whose descriptor is passed can be suspended