297 lines
9.8 KiB
Java
297 lines
9.8 KiB
Java
package b.f.j.p;
|
|
|
|
import android.graphics.Bitmap;
|
|
import b.f.d.d.f;
|
|
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 t0 implements w0<CloseableReference<b.f.j.j.c>> {
|
|
public final w0<CloseableReference<b.f.j.j.c>> a;
|
|
|
|
/* renamed from: b reason: collision with root package name */
|
|
public final PlatformBitmapFactory f636b;
|
|
public final Executor c;
|
|
|
|
/* compiled from: PostprocessorProducer */
|
|
public class b extends p<CloseableReference<b.f.j.j.c>, CloseableReference<b.f.j.j.c>> {
|
|
public final z0 c;
|
|
public final x0 d;
|
|
public final b.f.j.q.b e;
|
|
public boolean f;
|
|
public CloseableReference<b.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(t0 t0Var) {
|
|
}
|
|
|
|
@Override // b.f.j.p.y0
|
|
public void a() {
|
|
b bVar = b.this;
|
|
if (bVar.o()) {
|
|
bVar.f629b.d();
|
|
}
|
|
}
|
|
}
|
|
|
|
public b(l<CloseableReference<b.f.j.j.c>> lVar, z0 z0Var, b.f.j.q.b bVar, x0 x0Var) {
|
|
super(lVar);
|
|
this.c = z0Var;
|
|
this.e = bVar;
|
|
this.d = x0Var;
|
|
x0Var.f(new a(t0.this));
|
|
}
|
|
|
|
public static void n(b bVar, CloseableReference closeableReference, int i) {
|
|
Objects.requireNonNull(bVar);
|
|
b.c.a.a0.d.i(Boolean.valueOf(CloseableReference.y(closeableReference)));
|
|
if (!(((b.f.j.j.c) closeableReference.u()) instanceof b.f.j.j.d)) {
|
|
bVar.q(closeableReference, i);
|
|
return;
|
|
}
|
|
bVar.c.e(bVar.d, "PostprocessorProducer");
|
|
try {
|
|
CloseableReference<b.f.j.j.c> r = bVar.r((b.f.j.j.c) closeableReference.u());
|
|
try {
|
|
z0 z0Var = bVar.c;
|
|
x0 x0Var = bVar.d;
|
|
z0Var.j(x0Var, "PostprocessorProducer", bVar.p(z0Var, x0Var, bVar.e));
|
|
bVar.q(r, i);
|
|
} finally {
|
|
if (r != null) {
|
|
r.close();
|
|
}
|
|
}
|
|
} catch (Exception e) {
|
|
z0 z0Var2 = bVar.c;
|
|
x0 x0Var2 = bVar.d;
|
|
z0Var2.k(x0Var2, "PostprocessorProducer", e, bVar.p(z0Var2, x0Var2, bVar.e));
|
|
if (bVar.o()) {
|
|
bVar.f629b.c(e);
|
|
}
|
|
}
|
|
}
|
|
|
|
@Override // b.f.j.p.p, b.f.j.p.b
|
|
public void g() {
|
|
if (o()) {
|
|
this.f629b.d();
|
|
}
|
|
}
|
|
|
|
@Override // b.f.j.p.p, b.f.j.p.b
|
|
public void h(Throwable th) {
|
|
if (o()) {
|
|
this.f629b.c(th);
|
|
}
|
|
}
|
|
|
|
@Override // b.f.j.p.b
|
|
public void i(Object obj, int i) {
|
|
CloseableReference<b.f.j.j.c> closeableReference;
|
|
boolean s2;
|
|
CloseableReference closeableReference2 = (CloseableReference) obj;
|
|
if (CloseableReference.y(closeableReference2)) {
|
|
synchronized (this) {
|
|
if (!this.f) {
|
|
closeableReference = this.g;
|
|
this.g = CloseableReference.n(closeableReference2);
|
|
this.h = i;
|
|
this.i = true;
|
|
s2 = s();
|
|
} else {
|
|
return;
|
|
}
|
|
}
|
|
if (closeableReference != null) {
|
|
closeableReference.close();
|
|
}
|
|
if (s2) {
|
|
t0.this.c.execute(new u0(this));
|
|
}
|
|
} else if (b.e(i)) {
|
|
q(null, i);
|
|
}
|
|
}
|
|
|
|
public final boolean o() {
|
|
CloseableReference<b.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.j;
|
|
if (closeableReference != null) {
|
|
closeableReference.close();
|
|
}
|
|
return true;
|
|
}
|
|
|
|
public final Map<String, String> p(z0 z0Var, x0 x0Var, b.f.j.q.b bVar) {
|
|
if (!z0Var.g(x0Var, "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<b.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.f629b.b(closeableReference, i);
|
|
}
|
|
|
|
public final CloseableReference<b.f.j.j.c> r(b.f.j.j.c cVar) {
|
|
b.f.j.j.d dVar = (b.f.j.j.d) cVar;
|
|
CloseableReference<Bitmap> process = this.e.process(dVar.m, t0.this.f636b);
|
|
try {
|
|
b.f.j.j.d dVar2 = new b.f.j.j.d(process, cVar.b(), dVar.o, dVar.p);
|
|
dVar2.e(dVar.k);
|
|
CloseableReference<b.f.j.j.c> A = CloseableReference.A(dVar2);
|
|
if (process != null) {
|
|
process.close();
|
|
}
|
|
return A;
|
|
} catch (Throwable th) {
|
|
Class<CloseableReference> cls = CloseableReference.j;
|
|
if (process != null) {
|
|
process.close();
|
|
}
|
|
throw th;
|
|
}
|
|
}
|
|
|
|
public final synchronized boolean s() {
|
|
if (this.f || !this.i || this.j || !CloseableReference.y(this.g)) {
|
|
return false;
|
|
}
|
|
this.j = true;
|
|
return true;
|
|
}
|
|
}
|
|
|
|
/* compiled from: PostprocessorProducer */
|
|
public class c extends p<CloseableReference<b.f.j.j.c>, CloseableReference<b.f.j.j.c>> implements b.f.j.q.d {
|
|
public boolean c = false;
|
|
public CloseableReference<b.f.j.j.c> d = null;
|
|
|
|
public c(t0 t0Var, b bVar, b.f.j.q.c cVar, x0 x0Var, a aVar) {
|
|
super(bVar);
|
|
cVar.a(this);
|
|
x0Var.f(new v0(this, t0Var));
|
|
}
|
|
|
|
@Override // b.f.j.p.p, b.f.j.p.b
|
|
public void g() {
|
|
if (n()) {
|
|
this.f629b.d();
|
|
}
|
|
}
|
|
|
|
@Override // b.f.j.p.p, b.f.j.p.b
|
|
public void h(Throwable th) {
|
|
if (n()) {
|
|
this.f629b.c(th);
|
|
}
|
|
}
|
|
|
|
@Override // b.f.j.p.b
|
|
public void i(Object obj, int i) {
|
|
CloseableReference n;
|
|
CloseableReference closeableReference = (CloseableReference) obj;
|
|
if (!b.f(i)) {
|
|
synchronized (this) {
|
|
if (!this.c) {
|
|
CloseableReference<b.f.j.j.c> closeableReference2 = this.d;
|
|
this.d = CloseableReference.n(closeableReference);
|
|
if (closeableReference2 != null) {
|
|
closeableReference2.close();
|
|
}
|
|
}
|
|
}
|
|
synchronized (this) {
|
|
if (!this.c) {
|
|
n = CloseableReference.n(this.d);
|
|
} else {
|
|
return;
|
|
}
|
|
}
|
|
try {
|
|
this.f629b.b(n, 0);
|
|
} finally {
|
|
if (n != null) {
|
|
n.close();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
public final boolean n() {
|
|
CloseableReference<b.f.j.j.c> closeableReference;
|
|
synchronized (this) {
|
|
if (this.c) {
|
|
return false;
|
|
}
|
|
closeableReference = this.d;
|
|
this.d = null;
|
|
this.c = true;
|
|
}
|
|
Class<CloseableReference> cls = CloseableReference.j;
|
|
if (closeableReference != null) {
|
|
closeableReference.close();
|
|
}
|
|
return true;
|
|
}
|
|
}
|
|
|
|
/* compiled from: PostprocessorProducer */
|
|
public class d extends p<CloseableReference<b.f.j.j.c>, CloseableReference<b.f.j.j.c>> {
|
|
public d(t0 t0Var, b bVar, a aVar) {
|
|
super(bVar);
|
|
}
|
|
|
|
@Override // b.f.j.p.b
|
|
public void i(Object obj, int i) {
|
|
CloseableReference closeableReference = (CloseableReference) obj;
|
|
if (!b.f(i)) {
|
|
this.f629b.b(closeableReference, i);
|
|
}
|
|
}
|
|
}
|
|
|
|
public t0(w0<CloseableReference<b.f.j.j.c>> w0Var, PlatformBitmapFactory platformBitmapFactory, Executor executor) {
|
|
Objects.requireNonNull(w0Var);
|
|
this.a = w0Var;
|
|
this.f636b = platformBitmapFactory;
|
|
Objects.requireNonNull(executor);
|
|
this.c = executor;
|
|
}
|
|
|
|
@Override // b.f.j.p.w0
|
|
public void b(l<CloseableReference<b.f.j.j.c>> lVar, x0 x0Var) {
|
|
z0 o = x0Var.o();
|
|
b.f.j.q.b bVar = x0Var.e().f2876s;
|
|
Objects.requireNonNull(bVar);
|
|
b bVar2 = new b(lVar, o, bVar, x0Var);
|
|
this.a.b(bVar instanceof b.f.j.q.c ? new c(this, bVar2, (b.f.j.q.c) bVar, x0Var, null) : new d(this, bVar2, null), x0Var);
|
|
}
|
|
}
|