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

159 lines
6.0 KiB
Java

package c.f.j.p;
import c.f.d.d.f;
import c.f.i.c;
import c.f.j.c.i;
import c.f.j.c.n;
import c.f.j.c.w;
import c.f.j.j.e;
import c.f.j.r.b;
import com.facebook.cache.common.CacheKey;
import com.facebook.common.memory.PooledByteBuffer;
import com.facebook.common.references.CloseableReference;
import com.facebook.imagepipeline.request.ImageRequest;
import java.util.Map;
/* compiled from: EncodedMemoryCacheProducer */
public class v implements v0<e> {
public final w<CacheKey, PooledByteBuffer> a;
public final i b;
/* renamed from: c reason: collision with root package name */
public final v0<e> f499c;
/* compiled from: EncodedMemoryCacheProducer */
public static class a extends p<e, e> {
/* renamed from: c reason: collision with root package name */
public final w<CacheKey, PooledByteBuffer> f500c;
public final CacheKey d;
public final boolean e;
public final boolean f;
public a(l<e> lVar, w<CacheKey, PooledByteBuffer> wVar, CacheKey cacheKey, boolean z2, boolean z3) {
super(lVar);
this.f500c = wVar;
this.d = cacheKey;
this.e = z2;
this.f = z3;
}
/* JADX INFO: finally extract failed */
@Override // c.f.j.p.b
public void i(Object obj, int i) {
e eVar = (e) obj;
try {
b.b();
if (!b.f(i) && eVar != null && !b.l(i, 10)) {
eVar.w();
if (eVar.k != c.a) {
CloseableReference<PooledByteBuffer> c2 = eVar.c();
if (c2 != null) {
CloseableReference<PooledByteBuffer> closeableReference = null;
try {
if (this.f && this.e) {
closeableReference = this.f500c.a(this.d, c2);
}
if (closeableReference != null) {
try {
e eVar2 = new e(closeableReference);
eVar2.b(eVar);
try {
this.b.a(1.0f);
this.b.b(eVar2, i);
b.b();
} finally {
eVar2.close();
}
} finally {
closeableReference.close();
}
}
} finally {
c2.close();
}
}
this.b.b(eVar, i);
b.b();
}
}
this.b.b(eVar, i);
b.b();
} catch (Throwable th) {
b.b();
throw th;
}
}
}
public v(w<CacheKey, PooledByteBuffer> wVar, i iVar, v0<e> v0Var) {
this.a = wVar;
this.b = iVar;
this.f499c = v0Var;
}
/* JADX INFO: finally extract failed */
@Override // c.f.j.p.v0
public void b(l<e> lVar, w0 w0Var) {
try {
b.b();
y0 o = w0Var.o();
o.e(w0Var, "EncodedMemoryCacheProducer");
CacheKey b = ((n) this.b).b(w0Var.e(), w0Var.b());
CloseableReference<PooledByteBuffer> closeableReference = this.a.get(b);
Map<String, String> map = null;
if (closeableReference != null) {
try {
e eVar = new e(closeableReference);
try {
if (o.g(w0Var, "EncodedMemoryCacheProducer")) {
map = f.of("cached_value_found", "true");
}
o.j(w0Var, "EncodedMemoryCacheProducer", map);
o.c(w0Var, "EncodedMemoryCacheProducer", true);
w0Var.n("memory_encoded");
lVar.a(1.0f);
lVar.b(eVar, 1);
eVar.close();
closeableReference.close();
b.b();
} catch (Throwable th) {
eVar.close();
throw th;
}
} catch (Throwable th2) {
Class<CloseableReference> cls = CloseableReference.i;
if (closeableReference != null) {
closeableReference.close();
}
throw th2;
}
} else if (w0Var.q().g() >= ImageRequest.c.ENCODED_MEMORY_CACHE.g()) {
o.j(w0Var, "EncodedMemoryCacheProducer", o.g(w0Var, "EncodedMemoryCacheProducer") ? f.of("cached_value_found", "false") : null);
o.c(w0Var, "EncodedMemoryCacheProducer", false);
w0Var.i("memory_encoded", "nil-result");
lVar.b(null, 1);
Class<CloseableReference> cls2 = CloseableReference.i;
if (closeableReference != null) {
closeableReference.close();
}
b.b();
} else {
a aVar = new a(lVar, this.a, b, w0Var.e().o, w0Var.g().w.e);
if (o.g(w0Var, "EncodedMemoryCacheProducer")) {
map = f.of("cached_value_found", "false");
}
o.j(w0Var, "EncodedMemoryCacheProducer", map);
this.f499c.b(aVar, w0Var);
Class<CloseableReference> cls3 = CloseableReference.i;
if (closeableReference != null) {
closeableReference.close();
}
b.b();
}
} catch (Throwable th3) {
b.b();
throw th3;
}
}
}