Initial commit
This commit is contained in:
103
sources/com/bumptech/glide/util/pool/FactoryPools.java
Normal file
103
sources/com/bumptech/glide/util/pool/FactoryPools.java
Normal file
@@ -0,0 +1,103 @@
|
||||
package com.bumptech.glide.util.pool;
|
||||
|
||||
import android.util.Log;
|
||||
import androidx.core.util.Pools$Pool;
|
||||
import androidx.core.util.Pools$SimplePool;
|
||||
import androidx.core.util.Pools$SynchronizedPool;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class FactoryPools {
|
||||
private static final Resetter<Object> a = new Resetter<Object>() { // from class: com.bumptech.glide.util.pool.FactoryPools.1
|
||||
@Override // com.bumptech.glide.util.pool.FactoryPools.Resetter
|
||||
public void a(Object obj) {
|
||||
}
|
||||
};
|
||||
|
||||
public interface Factory<T> {
|
||||
T a();
|
||||
}
|
||||
|
||||
public interface Poolable {
|
||||
StateVerifier c();
|
||||
}
|
||||
|
||||
public interface Resetter<T> {
|
||||
void a(T t);
|
||||
}
|
||||
|
||||
public static <T extends Poolable> Pools$Pool<T> a(int i, Factory<T> factory) {
|
||||
return a(new Pools$SimplePool(i), factory);
|
||||
}
|
||||
|
||||
public static <T extends Poolable> Pools$Pool<T> b(int i, Factory<T> factory) {
|
||||
return a(new Pools$SynchronizedPool(i), factory);
|
||||
}
|
||||
|
||||
public static <T> Pools$Pool<List<T>> a(int i) {
|
||||
return a(new Pools$SynchronizedPool(i), new Factory<List<T>>() { // from class: com.bumptech.glide.util.pool.FactoryPools.2
|
||||
@Override // com.bumptech.glide.util.pool.FactoryPools.Factory
|
||||
public List<T> a() {
|
||||
return new ArrayList();
|
||||
}
|
||||
}, new Resetter<List<T>>() { // from class: com.bumptech.glide.util.pool.FactoryPools.3
|
||||
@Override // com.bumptech.glide.util.pool.FactoryPools.Resetter
|
||||
public void a(List<T> list) {
|
||||
list.clear();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static <T> Pools$Pool<List<T>> b() {
|
||||
return a(20);
|
||||
}
|
||||
|
||||
private static <T extends Poolable> Pools$Pool<T> a(Pools$Pool<T> pools$Pool, Factory<T> factory) {
|
||||
return a(pools$Pool, factory, a());
|
||||
}
|
||||
|
||||
private static <T> Pools$Pool<T> a(Pools$Pool<T> pools$Pool, Factory<T> factory, Resetter<T> resetter) {
|
||||
return new FactoryPool(pools$Pool, factory, resetter);
|
||||
}
|
||||
|
||||
private static <T> Resetter<T> a() {
|
||||
return (Resetter<T>) a;
|
||||
}
|
||||
|
||||
private static final class FactoryPool<T> implements Pools$Pool<T> {
|
||||
private final Factory<T> a;
|
||||
private final Resetter<T> b;
|
||||
private final Pools$Pool<T> c;
|
||||
|
||||
FactoryPool(Pools$Pool<T> pools$Pool, Factory<T> factory, Resetter<T> resetter) {
|
||||
this.c = pools$Pool;
|
||||
this.a = factory;
|
||||
this.b = resetter;
|
||||
}
|
||||
|
||||
@Override // androidx.core.util.Pools$Pool
|
||||
public T a() {
|
||||
T a = this.c.a();
|
||||
if (a == null) {
|
||||
a = this.a.a();
|
||||
if (Log.isLoggable("FactoryPools", 2)) {
|
||||
Log.v("FactoryPools", "Created new " + a.getClass());
|
||||
}
|
||||
}
|
||||
if (a instanceof Poolable) {
|
||||
a.c().a(false);
|
||||
}
|
||||
return (T) a;
|
||||
}
|
||||
|
||||
@Override // androidx.core.util.Pools$Pool
|
||||
public boolean a(T t) {
|
||||
if (t instanceof Poolable) {
|
||||
((Poolable) t).c().a(true);
|
||||
}
|
||||
this.b.a(t);
|
||||
return this.c.a(t);
|
||||
}
|
||||
}
|
||||
}
|
16
sources/com/bumptech/glide/util/pool/GlideTrace.java
Normal file
16
sources/com/bumptech/glide/util/pool/GlideTrace.java
Normal file
@@ -0,0 +1,16 @@
|
||||
package com.bumptech.glide.util.pool;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class GlideTrace {
|
||||
public static void a() {
|
||||
}
|
||||
|
||||
public static void a(String str) {
|
||||
}
|
||||
|
||||
public static void a(String str, Object obj) {
|
||||
}
|
||||
|
||||
public static void a(String str, Object obj, Object obj2, Object obj3) {
|
||||
}
|
||||
}
|
35
sources/com/bumptech/glide/util/pool/StateVerifier.java
Normal file
35
sources/com/bumptech/glide/util/pool/StateVerifier.java
Normal file
@@ -0,0 +1,35 @@
|
||||
package com.bumptech.glide.util.pool;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public abstract class StateVerifier {
|
||||
public static StateVerifier b() {
|
||||
return new DefaultStateVerifier();
|
||||
}
|
||||
|
||||
public abstract void a();
|
||||
|
||||
abstract void a(boolean z);
|
||||
|
||||
private static class DefaultStateVerifier extends StateVerifier {
|
||||
private volatile boolean a;
|
||||
|
||||
DefaultStateVerifier() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.util.pool.StateVerifier
|
||||
public void a() {
|
||||
if (this.a) {
|
||||
throw new IllegalStateException("Already released");
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.util.pool.StateVerifier
|
||||
public void a(boolean z) {
|
||||
this.a = z;
|
||||
}
|
||||
}
|
||||
|
||||
private StateVerifier() {
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user