Initial commit
This commit is contained in:
84
sources/com/bumptech/glide/load/engine/LockedResource.java
Normal file
84
sources/com/bumptech/glide/load/engine/LockedResource.java
Normal file
@@ -0,0 +1,84 @@
|
||||
package com.bumptech.glide.load.engine;
|
||||
|
||||
import androidx.core.util.Pools$Pool;
|
||||
import com.bumptech.glide.util.Preconditions;
|
||||
import com.bumptech.glide.util.pool.FactoryPools;
|
||||
import com.bumptech.glide.util.pool.StateVerifier;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
final class LockedResource<Z> implements Resource<Z>, FactoryPools.Poolable {
|
||||
private static final Pools$Pool<LockedResource<?>> e = FactoryPools.b(20, new FactoryPools.Factory<LockedResource<?>>() { // from class: com.bumptech.glide.load.engine.LockedResource.1
|
||||
/* JADX WARN: Can't rename method to resolve collision */
|
||||
@Override // com.bumptech.glide.util.pool.FactoryPools.Factory
|
||||
public LockedResource<?> a() {
|
||||
return new LockedResource<>();
|
||||
}
|
||||
});
|
||||
private final StateVerifier a = StateVerifier.b();
|
||||
private Resource<Z> b;
|
||||
private boolean c;
|
||||
private boolean d;
|
||||
|
||||
LockedResource() {
|
||||
}
|
||||
|
||||
private void a(Resource<Z> resource) {
|
||||
this.d = false;
|
||||
this.c = true;
|
||||
this.b = resource;
|
||||
}
|
||||
|
||||
static <Z> LockedResource<Z> b(Resource<Z> resource) {
|
||||
LockedResource a = e.a();
|
||||
Preconditions.a(a);
|
||||
LockedResource lockedResource = a;
|
||||
lockedResource.a(resource);
|
||||
return lockedResource;
|
||||
}
|
||||
|
||||
private void e() {
|
||||
this.b = null;
|
||||
e.a(this);
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.util.pool.FactoryPools.Poolable
|
||||
public StateVerifier c() {
|
||||
return this.a;
|
||||
}
|
||||
|
||||
synchronized void d() {
|
||||
this.a.a();
|
||||
if (!this.c) {
|
||||
throw new IllegalStateException("Already unlocked");
|
||||
}
|
||||
this.c = false;
|
||||
if (this.d) {
|
||||
a();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.engine.Resource
|
||||
public Z get() {
|
||||
return this.b.get();
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.engine.Resource
|
||||
public int getSize() {
|
||||
return this.b.getSize();
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.engine.Resource
|
||||
public Class<Z> b() {
|
||||
return this.b.b();
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.engine.Resource
|
||||
public synchronized void a() {
|
||||
this.a.a();
|
||||
this.d = true;
|
||||
if (!this.c) {
|
||||
this.b.a();
|
||||
e();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user