discord-jadx/app/src/main/java/c/f/j/p/h.java

161 lines
5.7 KiB
Java

package c.f.j.p;
import c.f.d.d.f;
import c.f.j.c.i;
import c.f.j.c.n;
import c.f.j.c.w;
import c.f.j.j.c;
import c.f.j.r.b;
import com.facebook.cache.common.CacheKey;
import com.facebook.common.references.CloseableReference;
import com.facebook.imagepipeline.request.ImageRequest;
import java.util.Map;
/* compiled from: BitmapMemoryCacheProducer */
public class h implements v0<CloseableReference<c>> {
public final w<CacheKey, c> a;
public final i b;
/* renamed from: c reason: collision with root package name */
public final v0<CloseableReference<c>> f470c;
/* compiled from: BitmapMemoryCacheProducer */
public class a extends p<CloseableReference<c>, CloseableReference<c>> {
/* renamed from: c reason: collision with root package name */
public final /* synthetic */ CacheKey f471c;
public final /* synthetic */ boolean d;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public a(l lVar, CacheKey cacheKey, boolean z2) {
super(lVar);
this.f471c = cacheKey;
this.d = z2;
}
/* JADX INFO: finally extract failed */
@Override // c.f.j.p.b
public void i(Object obj, int i) {
CloseableReference<c> closeableReference;
CloseableReference<c> closeableReference2 = (CloseableReference) obj;
try {
b.b();
boolean e = b.e(i);
CloseableReference<c> closeableReference3 = null;
if (closeableReference2 == null) {
if (e) {
this.b.b(null, i);
}
} else if (closeableReference2.w().d() || b.m(i, 8)) {
this.b.b(closeableReference2, i);
} else {
if (!e && (closeableReference = h.this.a.get(this.f471c)) != null) {
try {
c.f.j.j.i b = closeableReference2.w().b();
c.f.j.j.i b2 = closeableReference.w().b();
if (((c.f.j.j.h) b2).d || ((c.f.j.j.h) b2).b >= ((c.f.j.j.h) b).b) {
this.b.b(closeableReference, i);
closeableReference.close();
}
} finally {
closeableReference.close();
}
}
if (this.d) {
closeableReference3 = h.this.a.a(this.f471c, closeableReference2);
}
if (e) {
try {
this.b.a(1.0f);
} catch (Throwable th) {
if (closeableReference3 != null) {
closeableReference3.close();
}
throw th;
}
}
l<O> lVar = this.b;
if (closeableReference3 != null) {
closeableReference2 = closeableReference3;
}
lVar.b(closeableReference2, i);
if (closeableReference3 != null) {
closeableReference3.close();
}
}
b.b();
} catch (Throwable th2) {
b.b();
throw th2;
}
}
}
public h(w<CacheKey, c> wVar, i iVar, v0<CloseableReference<c>> v0Var) {
this.a = wVar;
this.b = iVar;
this.f470c = v0Var;
}
/* JADX INFO: finally extract failed */
@Override // c.f.j.p.v0
public void b(l<CloseableReference<c>> lVar, w0 w0Var) {
try {
b.b();
y0 o = w0Var.o();
o.e(w0Var, d());
CacheKey a2 = ((n) this.b).a(w0Var.e(), w0Var.b());
CloseableReference<c> closeableReference = this.a.get(a2);
Map<String, String> map = null;
if (closeableReference != null) {
w0Var.j(closeableReference.w().a());
boolean z2 = ((c.f.j.j.h) closeableReference.w().b()).d;
if (z2) {
o.j(w0Var, d(), o.g(w0Var, d()) ? f.of("cached_value_found", "true") : null);
o.c(w0Var, d(), true);
w0Var.i("memory_bitmap", c());
lVar.a(1.0f);
}
lVar.b(closeableReference, z2 ? 1 : 0);
closeableReference.close();
if (z2) {
b.b();
return;
}
}
if (w0Var.q().g() >= ImageRequest.c.BITMAP_MEMORY_CACHE.g()) {
o.j(w0Var, d(), o.g(w0Var, d()) ? f.of("cached_value_found", "false") : null);
o.c(w0Var, d(), false);
w0Var.i("memory_bitmap", c());
lVar.b(null, 1);
b.b();
return;
}
l<CloseableReference<c>> e = e(lVar, a2, w0Var.e().o);
String d = d();
if (o.g(w0Var, d())) {
map = f.of("cached_value_found", "false");
}
o.j(w0Var, d, map);
b.b();
this.f470c.b(e, w0Var);
b.b();
b.b();
} catch (Throwable th) {
b.b();
throw th;
}
}
public String c() {
return "pipe_bg";
}
public String d() {
return "BitmapMemoryCacheProducer";
}
public l<CloseableReference<c>> e(l<CloseableReference<c>> lVar, CacheKey cacheKey, boolean z2) {
return new a(lVar, cacheKey, z2);
}
}