package h6; import android.os.Process; import h6.t; 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; /* loaded from: classes2.dex */ final class i { /* renamed from: a, reason: collision with root package name */ private final boolean f10381a; /* renamed from: b, reason: collision with root package name */ private final Executor f10382b; /* renamed from: c, reason: collision with root package name */ final Map f10383c; /* renamed from: d, reason: collision with root package name */ private final ReferenceQueue f10384d; /* renamed from: e, reason: collision with root package name */ private t.a f10385e; /* renamed from: f, reason: collision with root package name */ private volatile boolean f10386f; class a implements ThreadFactory { /* renamed from: h6.i$a$a, reason: collision with other inner class name */ class RunnableC0155a implements Runnable { /* renamed from: a, reason: collision with root package name */ final /* synthetic */ Runnable f10387a; RunnableC0155a(a aVar, Runnable runnable) { this.f10387a = runnable; } @Override // java.lang.Runnable public void run() { Process.setThreadPriority(10); this.f10387a.run(); } } a() { } @Override // java.util.concurrent.ThreadFactory public Thread newThread(Runnable runnable) { return new Thread(new RunnableC0155a(this, runnable), "glide-active-resources"); } } class b implements Runnable { b() { } @Override // java.lang.Runnable public void run() { i.this.a(); } } static final class c extends WeakReference { /* renamed from: a, reason: collision with root package name */ final e6.h f10389a; /* renamed from: b, reason: collision with root package name */ final boolean f10390b; /* renamed from: c, reason: collision with root package name */ h f10391c; c(e6.h hVar, t tVar, ReferenceQueue referenceQueue, boolean z10) { super(tVar, referenceQueue); this.f10389a = (e6.h) b7.j.d(hVar); this.f10391c = (tVar.f() && z10) ? (h) b7.j.d(tVar.e()) : null; this.f10390b = tVar.f(); } void a() { this.f10391c = null; clear(); } } i(boolean z10) { this(z10, Executors.newSingleThreadExecutor(new a())); } void a() { while (!this.f10386f) { try { d((c) this.f10384d.remove()); } catch (InterruptedException unused) { Thread.currentThread().interrupt(); } } } synchronized void b(e6.h hVar) { c cVar = (c) this.f10383c.remove(hVar); if (cVar != null) { cVar.a(); } } synchronized void c(e6.h hVar, t tVar) { c cVar = (c) this.f10383c.put(hVar, new c(hVar, tVar, this.f10384d, this.f10381a)); if (cVar != null) { cVar.a(); } } void d(c cVar) { h hVar; synchronized (this) { this.f10383c.remove(cVar.f10389a); if (cVar.f10390b && (hVar = cVar.f10391c) != null) { this.f10385e.d(cVar.f10389a, new t(hVar, true, false, cVar.f10389a, this.f10385e)); } } } void e(t.a aVar) { synchronized (aVar) { synchronized (this) { this.f10385e = aVar; } } } /* JADX WARN: Multi-variable type inference failed */ synchronized t f(e6.h hVar) { c cVar = (c) this.f10383c.get(hVar); if (cVar == null) { return null; } t tVar = (t) cVar.get(); if (tVar == null) { d(cVar); } return tVar; } i(boolean z10, Executor executor) { this.f10383c = new HashMap(); this.f10384d = new ReferenceQueue(); this.f10381a = z10; this.f10382b = executor; executor.execute(new b()); } }