95 lines
2.7 KiB
Java
95 lines
2.7 KiB
Java
package b.f.j.c;
|
|
|
|
import b.c.a.a0.d;
|
|
import b.f.d.e.a;
|
|
import b.f.j.j.e;
|
|
import com.facebook.cache.common.CacheKey;
|
|
import com.facebook.common.memory.PooledByteBuffer;
|
|
import com.facebook.common.references.CloseableReference;
|
|
import java.util.HashMap;
|
|
import java.util.Map;
|
|
import java.util.Objects;
|
|
/* compiled from: StagingArea.java */
|
|
/* loaded from: classes2.dex */
|
|
public class a0 {
|
|
public Map<CacheKey, e> a = new HashMap();
|
|
|
|
public synchronized e a(CacheKey cacheKey) {
|
|
Objects.requireNonNull(cacheKey);
|
|
e eVar = this.a.get(cacheKey);
|
|
if (eVar != null) {
|
|
synchronized (eVar) {
|
|
if (!e.u(eVar)) {
|
|
this.a.remove(cacheKey);
|
|
a.m(a0.class, "Found closed reference %d for key %s (%d)", Integer.valueOf(System.identityHashCode(eVar)), cacheKey.b(), Integer.valueOf(System.identityHashCode(cacheKey)));
|
|
return null;
|
|
}
|
|
eVar = e.a(eVar);
|
|
}
|
|
}
|
|
return eVar;
|
|
}
|
|
|
|
public synchronized void b(CacheKey cacheKey, e eVar) {
|
|
d.i(Boolean.valueOf(e.u(eVar)));
|
|
e put = this.a.put(cacheKey, e.a(eVar));
|
|
if (put != null) {
|
|
put.close();
|
|
}
|
|
synchronized (this) {
|
|
this.a.size();
|
|
int i = a.a;
|
|
}
|
|
}
|
|
|
|
public boolean c(CacheKey cacheKey) {
|
|
e remove;
|
|
Objects.requireNonNull(cacheKey);
|
|
synchronized (this) {
|
|
remove = this.a.remove(cacheKey);
|
|
}
|
|
if (remove == null) {
|
|
return false;
|
|
}
|
|
try {
|
|
return remove.t();
|
|
} finally {
|
|
remove.close();
|
|
}
|
|
}
|
|
|
|
/* JADX WARN: Code restructure failed: missing block: B:23:0x0060, code lost:
|
|
r7.close();
|
|
*/
|
|
/*
|
|
Code decompiled incorrectly, please refer to instructions dump.
|
|
*/
|
|
public synchronized boolean d(CacheKey cacheKey, e eVar) {
|
|
Objects.requireNonNull(cacheKey);
|
|
Objects.requireNonNull(eVar);
|
|
d.i(Boolean.valueOf(e.u(eVar)));
|
|
e eVar2 = this.a.get(cacheKey);
|
|
if (eVar2 == null) {
|
|
return false;
|
|
}
|
|
CloseableReference<PooledByteBuffer> c = eVar2.c();
|
|
CloseableReference<PooledByteBuffer> c2 = eVar.c();
|
|
if (!(c == null || c2 == null || c.u() != c2.u())) {
|
|
this.a.remove(cacheKey);
|
|
c2.close();
|
|
c.close();
|
|
eVar2.close();
|
|
synchronized (this) {
|
|
this.a.size();
|
|
int i = a.a;
|
|
}
|
|
return true;
|
|
}
|
|
if (c != null) {
|
|
c.close();
|
|
}
|
|
eVar2.close();
|
|
return false;
|
|
}
|
|
}
|