143 lines
4.3 KiB
Java
143 lines
4.3 KiB
Java
|
package o;
|
||
|
|
||
|
import android.os.Process;
|
||
|
import java.lang.ref.ReferenceQueue;
|
||
|
import java.lang.ref.WeakReference;
|
||
|
import java.util.HashMap;
|
||
|
import java.util.Map;
|
||
|
import java.util.concurrent.Executor;
|
||
|
import java.util.concurrent.Executors;
|
||
|
import java.util.concurrent.ThreadFactory;
|
||
|
import o.zuk;
|
||
|
|
||
|
/* loaded from: classes.dex */
|
||
|
final class mhz {
|
||
|
volatile Sts a;
|
||
|
volatile boolean b;
|
||
|
zuk.HBt c;
|
||
|
final ReferenceQueue<zuk<?>> d;
|
||
|
final Map<InterfaceC2545agd, HBt> e;
|
||
|
private final boolean f;
|
||
|
private final Executor g;
|
||
|
|
||
|
/* loaded from: classes.dex */
|
||
|
interface Sts {
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
public mhz(boolean z) {
|
||
|
this(z, Executors.newSingleThreadExecutor(new ThreadFactory() { // from class: o.mhz.3
|
||
|
@Override // java.util.concurrent.ThreadFactory
|
||
|
public final Thread newThread(Runnable runnable) {
|
||
|
return new Thread(new Runnable(this, runnable) { // from class: o.mhz.3.1
|
||
|
private Runnable a;
|
||
|
private AnonymousClass3 d;
|
||
|
|
||
|
{
|
||
|
this.d = this;
|
||
|
this.a = runnable;
|
||
|
}
|
||
|
|
||
|
@Override // java.lang.Runnable
|
||
|
public final void run() {
|
||
|
Process.setThreadPriority(10);
|
||
|
this.a.run();
|
||
|
}
|
||
|
}, "glide-active-resources");
|
||
|
}
|
||
|
}));
|
||
|
}
|
||
|
|
||
|
private mhz(boolean z, Executor executor) {
|
||
|
this.e = new HashMap();
|
||
|
this.d = new ReferenceQueue<>();
|
||
|
this.f = z;
|
||
|
this.g = executor;
|
||
|
executor.execute(new Runnable(this) { // from class: o.mhz.2
|
||
|
private mhz a;
|
||
|
|
||
|
{
|
||
|
this.a = this;
|
||
|
}
|
||
|
|
||
|
@Override // java.lang.Runnable
|
||
|
public final void run() {
|
||
|
mhz mhzVar = this.a;
|
||
|
while (true) {
|
||
|
boolean z2 = mhzVar.b;
|
||
|
try {
|
||
|
mhzVar.e((HBt) mhzVar.d.remove());
|
||
|
Sts sts = mhzVar.a;
|
||
|
} catch (InterruptedException unused) {
|
||
|
Thread.currentThread().interrupt();
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
public final void e(InterfaceC2545agd interfaceC2545agd, zuk<?> zukVar) {
|
||
|
synchronized (this) {
|
||
|
HBt put = this.e.put(interfaceC2545agd, new HBt(interfaceC2545agd, zukVar, this.d, this.f));
|
||
|
if (put != null) {
|
||
|
put.a = null;
|
||
|
put.clear();
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
public final zuk<?> e(InterfaceC2545agd interfaceC2545agd) {
|
||
|
synchronized (this) {
|
||
|
HBt hBt = this.e.get(interfaceC2545agd);
|
||
|
if (hBt == null) {
|
||
|
return null;
|
||
|
}
|
||
|
zuk<?> zukVar = hBt.get();
|
||
|
if (zukVar == null) {
|
||
|
e(hBt);
|
||
|
}
|
||
|
return zukVar;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
final void e(HBt hBt) {
|
||
|
synchronized (this) {
|
||
|
this.e.remove(hBt.c);
|
||
|
if (hBt.b) {
|
||
|
if (hBt.a != null) {
|
||
|
this.c.b(hBt.c, new zuk<>(hBt.a, true, false, hBt.c, this.c));
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
/* loaded from: classes.dex */
|
||
|
public static final class HBt extends WeakReference<zuk<?>> {
|
||
|
Ezi<?> a;
|
||
|
final boolean b;
|
||
|
final InterfaceC2545agd c;
|
||
|
|
||
|
HBt(InterfaceC2545agd interfaceC2545agd, zuk<?> zukVar, ReferenceQueue<? super zuk<?>> referenceQueue, boolean z) {
|
||
|
super(zukVar, referenceQueue);
|
||
|
Ezi<?> ezi;
|
||
|
if (interfaceC2545agd == null) {
|
||
|
throw new NullPointerException("Argument must not be null");
|
||
|
}
|
||
|
this.c = interfaceC2545agd;
|
||
|
if (zukVar.e && z) {
|
||
|
ezi = zukVar.b;
|
||
|
if (ezi == null) {
|
||
|
throw new NullPointerException("Argument must not be null");
|
||
|
}
|
||
|
} else {
|
||
|
ezi = null;
|
||
|
}
|
||
|
this.a = ezi;
|
||
|
this.b = zukVar.e;
|
||
|
}
|
||
|
}
|
||
|
}
|