264 lines
7.5 KiB
Java
264 lines
7.5 KiB
Java
package c.f.e;
|
|
|
|
import android.util.Pair;
|
|
import com.facebook.datasource.DataSource;
|
|
import java.util.Iterator;
|
|
import java.util.Map;
|
|
import java.util.Objects;
|
|
import java.util.concurrent.ConcurrentLinkedQueue;
|
|
import java.util.concurrent.Executor;
|
|
/* compiled from: AbstractDataSource */
|
|
public abstract class c<T> implements DataSource<T> {
|
|
public Map<String, Object> a;
|
|
public int b = 1;
|
|
|
|
/* renamed from: c reason: collision with root package name */
|
|
public boolean f357c = false;
|
|
public T d = null;
|
|
public Throwable e = null;
|
|
public float f = 0.0f;
|
|
public final ConcurrentLinkedQueue<Pair<f<T>, Executor>> g = new ConcurrentLinkedQueue<>();
|
|
|
|
@Override // com.facebook.datasource.DataSource
|
|
public Map<String, Object> a() {
|
|
return this.a;
|
|
}
|
|
|
|
@Override // com.facebook.datasource.DataSource
|
|
public synchronized boolean b() {
|
|
return this.d != null;
|
|
}
|
|
|
|
@Override // com.facebook.datasource.DataSource
|
|
public synchronized boolean c() {
|
|
boolean z2;
|
|
z2 = true;
|
|
if (this.b == 1) {
|
|
z2 = false;
|
|
}
|
|
return z2;
|
|
}
|
|
|
|
@Override // com.facebook.datasource.DataSource
|
|
public boolean close() {
|
|
T t;
|
|
synchronized (this) {
|
|
if (this.f357c) {
|
|
return false;
|
|
}
|
|
this.f357c = true;
|
|
t = this.d;
|
|
this.d = null;
|
|
}
|
|
if (t != null) {
|
|
g(t);
|
|
}
|
|
if (!c()) {
|
|
j();
|
|
}
|
|
synchronized (this) {
|
|
this.g.clear();
|
|
}
|
|
return true;
|
|
}
|
|
|
|
@Override // com.facebook.datasource.DataSource
|
|
public synchronized Throwable d() {
|
|
return this.e;
|
|
}
|
|
|
|
@Override // com.facebook.datasource.DataSource
|
|
public boolean e() {
|
|
return false;
|
|
}
|
|
|
|
@Override // com.facebook.datasource.DataSource
|
|
public void f(f<T> fVar, Executor executor) {
|
|
boolean z2;
|
|
Objects.requireNonNull(executor);
|
|
synchronized (this) {
|
|
if (!this.f357c) {
|
|
z2 = true;
|
|
if (this.b == 1) {
|
|
this.g.add(Pair.create(fVar, executor));
|
|
}
|
|
if (!b() && !c()) {
|
|
if (!n()) {
|
|
z2 = false;
|
|
}
|
|
}
|
|
} else {
|
|
return;
|
|
}
|
|
}
|
|
if (z2) {
|
|
executor.execute(new a(this, h(), fVar, n()));
|
|
}
|
|
}
|
|
|
|
public void g(T t) {
|
|
}
|
|
|
|
@Override // com.facebook.datasource.DataSource
|
|
public synchronized float getProgress() {
|
|
return this.f;
|
|
}
|
|
|
|
@Override // com.facebook.datasource.DataSource
|
|
public synchronized T getResult() {
|
|
return this.d;
|
|
}
|
|
|
|
public synchronized boolean h() {
|
|
return this.b == 3;
|
|
}
|
|
|
|
public synchronized boolean i() {
|
|
return this.f357c;
|
|
}
|
|
|
|
public final void j() {
|
|
boolean h = h();
|
|
boolean n = n();
|
|
Iterator<Pair<f<T>, Executor>> it = this.g.iterator();
|
|
while (it.hasNext()) {
|
|
Pair<f<T>, Executor> next = it.next();
|
|
((Executor) next.second).execute(new a(this, h, (f) next.first, n));
|
|
}
|
|
}
|
|
|
|
public boolean k(Throwable th, Map<String, Object> map) {
|
|
boolean z2;
|
|
synchronized (this) {
|
|
z2 = true;
|
|
if (!this.f357c) {
|
|
if (this.b == 1) {
|
|
this.b = 3;
|
|
this.e = th;
|
|
this.a = map;
|
|
}
|
|
}
|
|
z2 = false;
|
|
}
|
|
if (z2) {
|
|
j();
|
|
}
|
|
return z2;
|
|
}
|
|
|
|
public boolean l(float f) {
|
|
boolean z2;
|
|
synchronized (this) {
|
|
z2 = false;
|
|
if (!this.f357c) {
|
|
if (this.b == 1) {
|
|
if (f >= this.f) {
|
|
this.f = f;
|
|
z2 = true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (z2) {
|
|
Iterator<Pair<f<T>, Executor>> it = this.g.iterator();
|
|
while (it.hasNext()) {
|
|
Pair<f<T>, Executor> next = it.next();
|
|
((Executor) next.second).execute(new b(this, (f) next.first));
|
|
}
|
|
}
|
|
return z2;
|
|
}
|
|
|
|
/* JADX WARNING: Code restructure failed: missing block: B:20:0x0023, code lost:
|
|
if (r4 == null) goto L_0x002d;
|
|
*/
|
|
/* JADX WARNING: Code restructure failed: missing block: B:24:0x0028, code lost:
|
|
if (r4 != null) goto L_0x002a;
|
|
*/
|
|
/* JADX WARNING: Code restructure failed: missing block: B:25:0x002a, code lost:
|
|
g(r4);
|
|
*/
|
|
/* JADX WARNING: Code restructure failed: missing block: B:26:0x002d, code lost:
|
|
if (r1 == false) goto L_0x0032;
|
|
*/
|
|
/* JADX WARNING: Code restructure failed: missing block: B:27:0x002f, code lost:
|
|
j();
|
|
*/
|
|
/* JADX WARNING: Code restructure failed: missing block: B:28:0x0032, code lost:
|
|
return r1;
|
|
*/
|
|
/* JADX WARNING: Code restructure failed: missing block: B:38:0x003d, code lost:
|
|
r4 = th;
|
|
*/
|
|
/* JADX WARNING: Code restructure failed: missing block: B:39:0x003e, code lost:
|
|
r6 = r6;
|
|
*/
|
|
public boolean m(T t, boolean z2, Map<String, Object> map) {
|
|
Throwable th;
|
|
this.a = map;
|
|
T t2 = null;
|
|
try {
|
|
synchronized (this) {
|
|
try {
|
|
boolean z3 = true;
|
|
if (!this.f357c) {
|
|
if (this.b == 1) {
|
|
if (z2) {
|
|
this.b = 2;
|
|
this.f = 1.0f;
|
|
}
|
|
T t3 = this.d;
|
|
if (t3 != t) {
|
|
try {
|
|
this.d = t;
|
|
t = t3;
|
|
} catch (Throwable th2) {
|
|
th = th2;
|
|
t2 = t3;
|
|
while (true) {
|
|
try {
|
|
break;
|
|
} catch (Throwable th3) {
|
|
th = th3;
|
|
}
|
|
}
|
|
throw th;
|
|
}
|
|
} else {
|
|
t = null;
|
|
}
|
|
try {
|
|
} catch (Throwable th4) {
|
|
t3 = t;
|
|
th = th4;
|
|
t2 = t3;
|
|
while (true) {
|
|
break;
|
|
}
|
|
throw th;
|
|
}
|
|
}
|
|
}
|
|
z3 = false;
|
|
} catch (Throwable th5) {
|
|
th = th5;
|
|
while (true) {
|
|
break;
|
|
}
|
|
throw th;
|
|
}
|
|
}
|
|
} catch (Throwable th6) {
|
|
Throwable th7 = th6;
|
|
if (t2 != null) {
|
|
g(t2);
|
|
}
|
|
throw th7;
|
|
}
|
|
}
|
|
|
|
public final synchronized boolean n() {
|
|
return i() && !c();
|
|
}
|
|
}
|