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

302 lines
10 KiB
Java

package c.f.j.p;
import android.graphics.Bitmap;
import c.f.d.d.f;
import com.airbnb.lottie.parser.AnimatableValueParser;
import com.facebook.common.references.CloseableReference;
import com.facebook.imagepipeline.bitmaps.PlatformBitmapFactory;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.Executor;
/* compiled from: PostprocessorProducer */
public class s0 implements v0<CloseableReference<c.f.j.j.c>> {
public final v0<CloseableReference<c.f.j.j.c>> a;
public final PlatformBitmapFactory b;
/* renamed from: c reason: collision with root package name */
public final Executor f494c;
/* compiled from: PostprocessorProducer */
public class b extends p<CloseableReference<c.f.j.j.c>, CloseableReference<c.f.j.j.c>> {
/* renamed from: c reason: collision with root package name */
public final y0 f495c;
public final w0 d;
public final c.f.j.q.b e;
public boolean f;
public CloseableReference<c.f.j.j.c> g = null;
public int h = 0;
public boolean i = false;
public boolean j = false;
/* compiled from: PostprocessorProducer */
public class a extends e {
public a(s0 s0Var) {
}
@Override // c.f.j.p.x0
public void a() {
b bVar = b.this;
if (bVar.o()) {
bVar.b.d();
}
}
}
public b(l<CloseableReference<c.f.j.j.c>> lVar, y0 y0Var, c.f.j.q.b bVar, w0 w0Var) {
super(lVar);
this.f495c = y0Var;
this.e = bVar;
this.d = w0Var;
w0Var.f(new a(s0.this));
}
public static void n(b bVar, CloseableReference closeableReference, int i) {
Objects.requireNonNull(bVar);
AnimatableValueParser.j(Boolean.valueOf(CloseableReference.z(closeableReference)));
if (!(((c.f.j.j.c) closeableReference.w()) instanceof c.f.j.j.d)) {
bVar.q(closeableReference, i);
return;
}
bVar.f495c.e(bVar.d, "PostprocessorProducer");
try {
CloseableReference<c.f.j.j.c> r = bVar.r((c.f.j.j.c) closeableReference.w());
try {
y0 y0Var = bVar.f495c;
w0 w0Var = bVar.d;
y0Var.j(w0Var, "PostprocessorProducer", bVar.p(y0Var, w0Var, bVar.e));
bVar.q(r, i);
} finally {
if (r != null) {
r.close();
}
}
} catch (Exception e) {
y0 y0Var2 = bVar.f495c;
w0 w0Var2 = bVar.d;
y0Var2.k(w0Var2, "PostprocessorProducer", e, bVar.p(y0Var2, w0Var2, bVar.e));
if (bVar.o()) {
bVar.b.c(e);
}
}
}
@Override // c.f.j.p.p, c.f.j.p.b
public void g() {
if (o()) {
this.b.d();
}
}
@Override // c.f.j.p.p, c.f.j.p.b
public void h(Throwable th) {
if (o()) {
this.b.c(th);
}
}
@Override // c.f.j.p.b
public void i(Object obj, int i) {
CloseableReference<c.f.j.j.c> closeableReference;
boolean s2;
CloseableReference closeableReference2 = (CloseableReference) obj;
if (CloseableReference.z(closeableReference2)) {
synchronized (this) {
if (!this.f) {
closeableReference = this.g;
this.g = CloseableReference.p(closeableReference2);
this.h = i;
this.i = true;
s2 = s();
} else {
return;
}
}
if (closeableReference != null) {
closeableReference.close();
}
if (s2) {
s0.this.f494c.execute(new t0(this));
}
} else if (b.e(i)) {
q(null, i);
}
}
public final boolean o() {
CloseableReference<c.f.j.j.c> closeableReference;
synchronized (this) {
if (this.f) {
return false;
}
closeableReference = this.g;
this.g = null;
this.f = true;
}
Class<CloseableReference> cls = CloseableReference.i;
if (closeableReference != null) {
closeableReference.close();
}
return true;
}
public final Map<String, String> p(y0 y0Var, w0 w0Var, c.f.j.q.b bVar) {
if (!y0Var.g(w0Var, "PostprocessorProducer")) {
return null;
}
return f.of("Postprocessor", bVar.getName());
}
/* JADX WARNING: Code restructure failed: missing block: B:6:0x000a, code lost:
if (r1 != false) goto L_0x0010;
*/
public final void q(CloseableReference<c.f.j.j.c> closeableReference, int i) {
boolean e = b.e(i);
if (!e) {
synchronized (this) {
boolean z2 = this.f;
}
}
if (!e || !o()) {
return;
}
this.b.b(closeableReference, i);
}
public final CloseableReference<c.f.j.j.c> r(c.f.j.j.c cVar) {
c.f.j.j.d dVar = (c.f.j.j.d) cVar;
CloseableReference<Bitmap> process = this.e.process(dVar.l, s0.this.b);
try {
c.f.j.j.d dVar2 = new c.f.j.j.d(process, cVar.b(), dVar.n, dVar.o);
dVar2.e(dVar.j);
CloseableReference<c.f.j.j.c> C = CloseableReference.C(dVar2);
if (process != null) {
process.close();
}
return C;
} catch (Throwable th) {
Class<CloseableReference> cls = CloseableReference.i;
if (process != null) {
process.close();
}
throw th;
}
}
public final synchronized boolean s() {
if (this.f || !this.i || this.j || !CloseableReference.z(this.g)) {
return false;
}
this.j = true;
return true;
}
}
/* compiled from: PostprocessorProducer */
public class c extends p<CloseableReference<c.f.j.j.c>, CloseableReference<c.f.j.j.c>> implements c.f.j.q.d {
/* renamed from: c reason: collision with root package name */
public boolean f496c = false;
public CloseableReference<c.f.j.j.c> d = null;
public c(s0 s0Var, b bVar, c.f.j.q.c cVar, w0 w0Var, a aVar) {
super(bVar);
cVar.a(this);
w0Var.f(new u0(this, s0Var));
}
@Override // c.f.j.p.p, c.f.j.p.b
public void g() {
if (n()) {
this.b.d();
}
}
@Override // c.f.j.p.p, c.f.j.p.b
public void h(Throwable th) {
if (n()) {
this.b.c(th);
}
}
@Override // c.f.j.p.b
public void i(Object obj, int i) {
CloseableReference p;
CloseableReference closeableReference = (CloseableReference) obj;
if (!b.f(i)) {
synchronized (this) {
if (!this.f496c) {
CloseableReference<c.f.j.j.c> closeableReference2 = this.d;
this.d = CloseableReference.p(closeableReference);
if (closeableReference2 != null) {
closeableReference2.close();
}
}
}
synchronized (this) {
if (!this.f496c) {
p = CloseableReference.p(this.d);
} else {
return;
}
}
try {
this.b.b(p, 0);
} finally {
if (p != null) {
p.close();
}
}
}
}
public final boolean n() {
CloseableReference<c.f.j.j.c> closeableReference;
synchronized (this) {
if (this.f496c) {
return false;
}
closeableReference = this.d;
this.d = null;
this.f496c = true;
}
Class<CloseableReference> cls = CloseableReference.i;
if (closeableReference != null) {
closeableReference.close();
}
return true;
}
}
/* compiled from: PostprocessorProducer */
public class d extends p<CloseableReference<c.f.j.j.c>, CloseableReference<c.f.j.j.c>> {
public d(s0 s0Var, b bVar, a aVar) {
super(bVar);
}
@Override // c.f.j.p.b
public void i(Object obj, int i) {
CloseableReference closeableReference = (CloseableReference) obj;
if (!b.f(i)) {
this.b.b(closeableReference, i);
}
}
}
public s0(v0<CloseableReference<c.f.j.j.c>> v0Var, PlatformBitmapFactory platformBitmapFactory, Executor executor) {
Objects.requireNonNull(v0Var);
this.a = v0Var;
this.b = platformBitmapFactory;
Objects.requireNonNull(executor);
this.f494c = executor;
}
@Override // c.f.j.p.v0
public void b(l<CloseableReference<c.f.j.j.c>> lVar, w0 w0Var) {
y0 o = w0Var.o();
c.f.j.q.b bVar = w0Var.e().q;
b bVar2 = new b(lVar, o, bVar, w0Var);
this.a.b(bVar instanceof c.f.j.q.c ? new c(this, bVar2, (c.f.j.q.c) bVar, w0Var, null) : new d(this, bVar2, null), w0Var);
}
}