97 lines
2.8 KiB
Java
97 lines
2.8 KiB
Java
package c.f.j.c;
|
|
|
|
import c.f.d.e.a;
|
|
import c.f.j.j.e;
|
|
import com.airbnb.lottie.parser.AnimatableValueParser;
|
|
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 */
|
|
public class a0 {
|
|
public Map<CacheKey, e> a = new HashMap();
|
|
|
|
public synchronized e a(CacheKey cacheKey) {
|
|
e a;
|
|
Objects.requireNonNull(cacheKey);
|
|
e eVar = this.a.get(cacheKey);
|
|
if (eVar != null) {
|
|
synchronized (eVar) {
|
|
if (!e.t(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;
|
|
}
|
|
a = e.a(eVar);
|
|
}
|
|
eVar = a;
|
|
}
|
|
return eVar;
|
|
}
|
|
|
|
public synchronized void b(CacheKey cacheKey, e eVar) {
|
|
AnimatableValueParser.j(Boolean.valueOf(e.t(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.s();
|
|
} finally {
|
|
remove.close();
|
|
}
|
|
}
|
|
|
|
public synchronized boolean d(CacheKey cacheKey, e eVar) {
|
|
Objects.requireNonNull(cacheKey);
|
|
Objects.requireNonNull(eVar);
|
|
AnimatableValueParser.j(Boolean.valueOf(e.t(eVar)));
|
|
e eVar2 = this.a.get(cacheKey);
|
|
if (eVar2 == null) {
|
|
return false;
|
|
}
|
|
CloseableReference<PooledByteBuffer> c2 = eVar2.c();
|
|
CloseableReference<PooledByteBuffer> c3 = eVar.c();
|
|
if (!(c2 == null || c3 == null)) {
|
|
try {
|
|
if (c2.w() == c3.w()) {
|
|
this.a.remove(cacheKey);
|
|
synchronized (this) {
|
|
this.a.size();
|
|
int i = a.a;
|
|
}
|
|
return true;
|
|
}
|
|
} finally {
|
|
c3.close();
|
|
c2.close();
|
|
eVar2.close();
|
|
}
|
|
}
|
|
if (c3 != null) {
|
|
c3.close();
|
|
}
|
|
if (c2 != null) {
|
|
c2.close();
|
|
}
|
|
eVar2.close();
|
|
return false;
|
|
}
|
|
}
|