package com.tencent.mm.modelappbrand.a;

import android.graphics.Bitmap;
import android.support.v4.a.a;
import com.tencent.matrix.trace.core.AppMethodBeat;
import com.tencent.mm.a.f;
import com.tencent.mm.a.h;
import com.tencent.mm.modelappbrand.a.b.c;
import com.tencent.mm.sdk.platformtools.ab;
import java.lang.ref.Reference;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

class b$c$1 extends h<String, Reference<Bitmap>> {
    private final Map<Reference<Bitmap>, Integer> fqp = new ConcurrentHashMap();
    final /* synthetic */ c fqq;

    b$c$1(c cVar) {
        this.fqq = cVar;
        super(31457280);
        AppMethodBeat.i(77324);
        AppMethodBeat.o(77324);
    }

    public final /* synthetic */ void entryRemoved(boolean z, Object obj, Object obj2, Object obj3) {
        String str;
        AppMethodBeat.i(77328);
        String str2 = (String) obj;
        Reference reference = (Reference) obj2;
        Reference reference2 = (Reference) obj3;
        String str3 = "MicroMsg.AppBrandSimpleImageLoader.DefaultMemoryCache";
        String str4 = "entryRemoved, curSize %d KB, maxSize %d KB, oldBmp %s, newBmp %s";
        Object[] objArr = new Object[4];
        objArr[0] = Integer.valueOf(this.fqq.fqo.size() / 10);
        objArr[1] = Integer.valueOf(this.fqq.fqo.maxSize() / 10);
        if (reference == null) {
            str = "null-ref";
        } else {
            str = reference.get();
        }
        objArr[2] = str;
        if (reference2 == null) {
            str = "null-ref";
        } else {
            str = reference2.get();
        }
        objArr[3] = str;
        ab.d(str3, str4, objArr);
        super.entryRemoved(z, str2, reference, reference2);
        Bitmap bitmap = reference == null ? null : (Bitmap) reference.get();
        if (bitmap != (reference2 == null ? null : (Bitmap) reference2.get())) {
            this.fqq.f(bitmap);
        }
        this.fqp.remove(reference);
        AppMethodBeat.o(77328);
    }

    public final /* synthetic */ int sizeOf(Object obj, Object obj2) {
        AppMethodBeat.i(77327);
        Reference reference = (Reference) obj2;
        if (reference == null) {
            AppMethodBeat.o(77327);
            return 0;
        }
        Integer num = (Integer) this.fqp.get(reference);
        if (num == null || num.intValue() < 0) {
            int i;
            Bitmap bitmap = (Bitmap) reference.get();
            if (bitmap == null || bitmap.isRecycled()) {
                i = 0;
            } else {
                i = a.c(bitmap);
            }
            this.fqp.put(reference, Integer.valueOf(i));
            AppMethodBeat.o(77327);
            return i;
        }
        int intValue = num.intValue();
        AppMethodBeat.o(77327);
        return intValue;
    }

    public final void clear() {
        AppMethodBeat.i(77325);
        ab.d("MicroMsg.AppBrandSimpleImageLoader.DefaultMemoryCache", "clear");
        super.clear();
        this.fqp.clear();
        AppMethodBeat.o(77325);
    }

    public final void a(f.a<String, Reference<Bitmap>> aVar) {
        AppMethodBeat.i(77326);
        ab.d("MicroMsg.AppBrandSimpleImageLoader.DefaultMemoryCache", "clear(OnClearListener)");
        super.a(aVar);
        this.fqp.clear();
        AppMethodBeat.o(77326);
    }
}
